i have calendar placed on my form
i have one textbox n a button("Show date")
When the user enters date in the textbox say 29/07/2008 and click
on the show date button the calendar should show / reflect that date..
how to achieve this...i knw...it ll b simple but am not getting it...
i am also getting string to date conversion error n what not...
plz help me out...

protected void cmddate_Click(object sender, EventArgs e)
    {
        string mydate;
        mydate = txtdate.Text;
      
//HERE IS GET ERROR AS STRING WAS NOT RECOGNISED AS A VALID DATETIME..

  Calendar1.VisibleDate = Convert.ToDateTime(mydate);
      
     
    }

AM I USING CORRECT PROPERTY? PLZ SUGGEST
cya
Rohan

Recommended Answers

All 5 Replies

Post asp.net question in ASP.NET forum.

DateTime dt;
        DateTime.TryParse(TextBox1.Text, out dt);
        Calendar1.VisibleDate = dt;

Though its a asp quest but its in C# lang as for this code syntax is in c# so i posted it here......no offence.....
Okie...i will post in that forum frm next time...thanks
cya
Rohan

Post asp.net question in ASP.NET forum.

DateTime dt;
        DateTime.TryParse(TextBox1.Text, out dt);
        Calendar1.VisibleDate = dt;

Thanks buddy.
Did you get solution? If yes then mark this thread as solved.

nah buddy, i have not got solution as yet....plz help me out...ur code is also not working....cant figure out whts the error ?? :( :(

Thanks buddy.
Did you get solution? If yes then mark this thread as solved.

hey i got the solutions....i think i am almost der..............when i entered the date as 07/22/08 (mm/dd/yy) format i got the calendar shifted to 2008 however the date 22nd is not highlighted....how to achieve thisssss???????

Calendar1.VisibleDate = Convert.ToDateTime(txtdate.Text);

cya
Rohan

Thanks buddy.
Did you get solution? If yes then mark this thread as solved.

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.