private void ClearForm() { ((TextBox)DoctorDetailsFormView.FindControl("NameTextBox")).Text = ""; ((TextBox)DoctorDetailsFormView.FindControl("AddressTextBox")).Text = ""; ((TextBox)DoctorDetailsFormView.FindControl("LicenseTextBox")).Text = ""; ((DropDownList)DoctorDetailsFormView.FindControl("GenderDropdownList")).SelectedIndex = 0; ((TemplateControls_DatePicker)DoctorDetailsFormView.FindControl("DateOfBirthDatePicker")) .SelectedDate = DateTime.Now.Ticks; }
protected void DoctorDetailsDataSource_Updating(object sender, LinqDataSourceUpdateEventArgs e) { // get the new object var newObject = (Doctor)e.NewObject; // get the controls from the view var dateOfBirthDatePicker = (TemplateControls_DatePicker) DoctorDetailsFormView.FindControl("DateOfBirthDatePicker"); // set the date for the new object newObject.DateOfBirth = dateOfBirthDatePicker.SelectedDate; }