How To access the formView Controls in Asp.NET 2.0 using C#?

  • Thread starter Thread starter hi 2
  • Start date Start date
H

hi 2

Guest
i want to access a calendar control(Calendar1) that i have placed in the EditItemTemplate of the FormView.
what i want to do is when a date is selected i want that date to be assigned to the textbox(DOBTextBox)

i tried doing it with the following code but was unsuccessfull

protected void FormView1_DataBound(object sender, EventArgs e)
{
if (FormView1.CurrentMode == FormViewMode.Edit)
{
TextBox DOBTextBox = (TextBox)FormView1.EditItemTemplate.FindControl("DOBTextBox");
DOBTextBox.Text=Calendar1.SelectedDate;
}
}

thanks for the help in advance
 
Back
Top