Hello
I have a panel in my asp.net page (c#).
My code behind:
The event fires when the btnTransport button is clicked but it never recognises if a check box is or isn't selected and therefore never builds the mpString (line 17).
Is there a built in function/property for this or is it best to use the findcontrol method?
Any ideas?
Thanks
Dave
I have a panel in my asp.net page (c#).
My code behind:
Code:
CheckBoxList cbTransport = new CheckBoxList();
cbTransport.Items.Add("Car");
cbTransport.Items.Add("Bike");
cbTransport.Items.Add("Truck");
panelPitch.Controls.Add(cbTransport);
Button btnTransport = new Button();
btnTransport Text = "Search";
string mpString = "page.aspx?";
foreach(ListItem li in cbTransport.Items)
{
if (pitchItem.Selected)
{
mpString += "p=" + li + "&";
}
}
btnTransport.PostBackUrl = mpString;
panelPitch.Controls.Add(cbTransport);
panelPitch.Controls.Add(btnTransport);
The event fires when the btnTransport button is clicked but it never recognises if a check box is or isn't selected and therefore never builds the mpString (line 17).
Is there a built in function/property for this or is it best to use the findcontrol method?
Any ideas?
Thanks
Dave
Comment