Select calendar date problem in formview.
-
I want to embed a calendar in my a formview and pick a date from it which will be assigned to a textbox. I have a linkbutton to the initially hidden Calendar which set the mode of the Calendar to visible. OK so far. I next want to pick a date from the Calendar but so far have been unable to assign the selected date to the textbox. Here's my code. The errors I get are w.r.t the Calendar1_SelectionChanged method. 1. the object validToDate does not contain a definition for 'text' 2. the object cal does not contain a definition for 'SelectedDate' Here's the code: protected void Calendar1_SelectionChanged(object sender, EventArgs e) { object validToDate =null; validToDate = FormView1.FindControl("ValidToTextBox"); object cal=null; cal = FormView1FindControl("Calendar1"); validToDate.text= cal.SelectedDate.ToShortDateString(); FormView1.FindControl("Calendar1").Visible = false; } protected void linkButton1_Click(object sender, EventArgs e) { FormView1.FindControl("Calendar1").Visible = true; }