tags:

views:

30

answers:

1

i have a page with a checkbox. it has the related .cs code -->

protected void chkShowAll_CheckedChanged(object sender, EventArgs e)
{
    ctrlTime.ShowAllProjects = chkShowAll.Checked;
}

on clicking on the checkbox, a table appears. How do i keep that checkbox open by default so that the table appears WITH the page rather than checking on the box to access it?

A: 

Set the default state of the checkbox to "Checked", and set the appropriate "table load" property at page load time.

<asp:CheckBox ID="chkShowAll" runat="server" Checked="True" />

...

protected void Page_Load(object sender, EventArgs e)
{
    ctrlTime.ShowAllProjects = chkShowAll.Checked;
}
Michael Petrotta
this checks the box, but the gridview doesnt display. when i uncheck it and then check it back , then it displays.i changed the table load property to<asp:CheckBox ID="chkShowAll" runat="server" Checked="True" />removing the following property --> OnCheckedChanged="chkShowAll_CheckedChanged"does that have something to do with it?
Sophie
i figured it out cheers :)
Sophie
What fixed it? Add it here for future readers.
Michael Petrotta
well the checkbox was set in an Update Panel. I just seperated it and put it outside the panel and used the above mentioned code.
Sophie