I can access the calendar control inside the Gridview Footer Template. But it's not so easy to do the same thing in the EditItem Template
Can anybody suggest how to do this?
I am using 3 controls in the EditItem Template: Calendar
, ImageButton
, TextBox
as well as the Footer Template.
You can use the FindControl
method in FooterRow of GridView to make the calendar visible True/False
protected void MyDateInsButton_Click(object sender, EventArgs e)
{
if (GridView1.FooterRow.FindControl("MyDateInsCalendar").Visible == false)
{
GridView1.FooterRow.FindControl("MyDateInsCalendar").Visible = true;
}
else
{
GridView1.FooterRow.FindControl("MyDateInsCalendar").Visible = false;
}
}
And get the selected date inside the Footer TextBox
protected void MyDateInsCalendar_SelectionChanged(object sender, EventArgs e)
{
Calendar MyCal = (Calendar)sender;
((TextBox)GridView1.FooterRow.FindControl("txtinsMyDate")).Text = MyCal.SelectedDate.ToString("d");
GridView1.FooterRow.FindControl("MyDateInsCalendar").Visible = false;
}
How do you access the calendar control in the EditItem template to make it visible True and False?
protected void MyUpdButton_Click(object sender, EventArgs e)
{
}
The GridView1_RowUpdating
method will work for getting the selected date from the calendar control into the textbox control, but I still want to make the calendar appear and disappear when the user presses the image button.
Any help is appreciated. Thanks.