<CommandItemTemplate>
<div id="list_countries" onmouseover="mouseover()" onmouseout="mouseout()" >
<asp:CheckBoxList ID="CheckBoxList1" runat="server" OnSelectedIndexChanged="CheckBoxList1_SelectedIndexChanged">
</asp:CheckBoxList>
</div>
<CommandItemTemplate>
which runs this
protected
void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
CheckBoxList cbList = sender as CheckBoxList;
foreach
(ListItem listItem in cbList.Items)
RadGrid1.MasterTableView.Columns[cbList.Items.IndexOf(listItem)].Display = listItem.Selected;
}
This works great but I need to change it so instead of OnSelectedIndexChanged it runs off of a button like so
<CommandItemTemplate>
<
div id="list_countries" onmouseover="mouseover()" onmouseout="mouseout()" >
<asp:CheckBoxList ID="CheckBoxList1" runat="server" >
</asp:CheckBoxList>
</div>
<div class="commandmiddle">
<asp:Button ID="Button5" runat="server" Text="Show/Hide Columns" OnClick="CheckBoxList1_SelectedIndexChanged"> />
</div>
</CommandItemTemplate>
but I cant get the checkboxlist control in the CheckBoxList1_SelectedIndexChanged function if its from the button
what should I do?