Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi

i'm doing a web application using .net and c#

i have three dropdownlists to represent Date,Month and year

my problem is when i try to save this date to the database i need to convert this values to the type DateTime

 

when i'm trying to convert this it's giving me a error saying cannot convert string values to DateTime

 

What can i do ?

is there anyway to slolve this problem?

thanks in advance

Posted

i found a answer by my own

string dateString =dropdownlist1.selectedItem.Text+"/" + dropdownlist2.selectedItem.Text + "/" + dropdownlist3.selectedItem.Text;

DateTime convertedDate = DateTime.Parse(dateString);

 

this is how i did it

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...