protected void cb1_Init(object sender, EventArgs e) { ASPxCheckBox cb = sender as ASPxCheckBox; GridViewDataItemTemplateContainer container = cb.NamingContainer as GridViewDataItemTemplateContainer; cb.ID = "cb" + container.KeyValue; } protected void chkIndicator_CheckChanged(object sender, EventArgs e) { ASPxCheckBox cb = sender as ASPxCheckBox; string key = ((GridViewDataItemTemplateContainer)cb.NamingContainer).KeyValue.ToString(); AdministrationDataContext dc = new AdministrationDataContext(); List<IndicatorDashboardList> indicatorList = null; if (ViewState["dsDashbordIndicators"] == null) { indicatorList = dc.GetIndicatorsForSelectedDashboard(ViewState["DashboardKey"].ToString()).ToList(); } else { indicatorList = (List<IndicatorDashboardList>)ViewState["dsDashbordIndicators"]; } var row = indicatorList.Where(ds => ds.KeyField == key).FirstOrDefault(); if (row != null) { row.Included = cb.Checked ? "Y" : "N"; } ViewState["dsDashbordIndicators"] = indicatorList; } <asp:UpdatePanel ID="indicatorsPanel" runat="server"> <ContentTemplate> <dxwgv:ASPxGridView ID="indicatorsGridView" ClientInstanceName="indicatorsGrid" runat="server" AutoGenerateColumns="False" OnAfterPerformCallback="indicatorsGridView_CallBack" KeyFieldName="KeyField" Width="80%"> <SettingsPager AllButton-Visible="true"></SettingsPager> <Settings ShowFilterRow="true" ShowFilterRowMenu="true" /> <Columns> <dxwgv:GridViewDataTextColumn Caption="Indicator Name" FieldName="Name" CellStyle-HorizontalAlign="Left" /> <dxwgv:GridViewDataTextColumn Caption="Select" FieldName="Included"> <Settings AllowAutoFilter="False" /> <DataItemTemplate> <dxe:ASPxCheckBox ID="chkIndicator" runat="server" Value='<%# Eval("KeyField") %>' Checked='<%# Eval("Included").ToString() == "Y" %>' AutoPostBack="true" OnCheckedChanged="chkIndicator_CheckChanged" onInit="cb1_Init"> </dxe:ASPxCheckBox> </DataItemTemplate> <CellStyle HorizontalAlign="Center"/> </dxwgv:GridViewDataTextColumn> </Columns> </dxwgv:ASPxGridView> <!-- Clear Filter Button --> <table class="ClearFilterTable" onclick="indicatorsGrid.ClearFilter();"> <tr> <td><asp:Image id="imgClearIndicatorsGrid" runat="server" AlternateText="ClearFilter" ImageUrl="~/Images/FilterRemove.gif" CssClass="ClearFilterImage"/></td> <td>Clear Filter </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel>