Hi,

I need to build a datetime object out of 3 drop down lists. I know I can use DateTime.TryParse().. but I don't know what format it wants? I tried this:

showDate. = Convert.ToInt32(ddl_bday_day.SelectedValue);
        showDate.Month = Convert.ToInt32(ddl_bday_month.SelectedValue);
        showDate.Year = Convert.ToInt32(ddl_bday_year.SelectedValue);

But those are read only properties.

I then thried this but it choked:

string tempDate = ddl_bday_day.SelectedValue+ddl_bday_day.SelectedValue+ddl_bday_day.SelectedValue;

        DateTime showDate;
        DateTime.TryParse(tempDate, showDate);

Any ideas?

Well i cant help with your specific request, but if the point of the three drop down lists is to let the user schoose day, month and year, you can try using the date/time picker control.

Dar! I should have thought of that. That is what I'll do - thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.