I have an image button which should toggle the calendar whose visibility is set to false initially.
This is the Page_Load Code:
Calendar3.EnableViewState = false;
if (!IsPostBack)
{
BindData();
}
This is on imagebutton click.
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
if (Calendar3.Visible == false)
Calendar3.Visible = true;
else
Calendar3.Visible = false;
}
The calendar becomes visible on the first click and I can’t hide it if I click on the button again. How can I change visibility property of calendar control work on every button click.
PS: I’m using the calendar control and the imagebutton inside an update panel to take of postback and when I try to debug, the visibility property is set to default value from the calendar tag on every page_load.
Thanks
Remove the line
and you can simply write the button click event as: