Actually I found that the problem was the code behind page was pointing to a different page because I copied the HTML source from it into my new page. I resolved the problem.
Another issue is popping up though. I want to loop through all the controls on the page. When I do a loop from 0 to controls.count the count is only 3. It should be more. Is there another way to loop through the controls collection? The code for the loop is below.
for (int i = 0;i<=this.Controls.Count;i++)
{
if (this.Controls[i].ID.Substring(3,6) == "Flight")
this.Controls[i].Visible = chkFlight.Checked;
}
Jim
>>All,
>>
>> I have a webform with a checkbox and a panel with some controls in it. I want the checkbox to show or hide the panel based on the value of the checkbox, but my code is not working. The code I have for the checkbox is below, please help.
>>
>>
>>private void chkFlight_CheckedChanged(object sender, System.EventArgs e)
>> {
>> pnFlight.Visible = chkFlight.Checked;
>> }
>>
>
>Jim,
>
>Check your setting for the checkbox's AutoPostBack property. It needs to be set to True to get the behavior you need.
>
>hth,
Thanks
Jim