Hi,
I have a number of checkboxes within a grid. The state of these checkboxes change the enabled state of other columns within the grid when in edit mode.
Each checkbox has it's own OncheckedChanged event handler which enables/disables various columns. There seems to be a problem around when the event handler gets triggered. If you put a breakpoint within the event handler the run the app. When in the grid edit mode, if you check any checkbox the event handler triggers, if you uncheck it again it does not trigger the event handler. It seems like only half the functionality has been implemented. I have tried many different ways including using checkbox columns instead of using your panels method and adding the autopostback and event handler programatically, auto-generating columns but it still only seems to fire the OnCheckedChanged event in one direction. I have looked through your knowledgebase/forums without joy. Any help appreciated.
I have a number of checkboxes within a grid. The state of these checkboxes change the enabled state of other columns within the grid when in edit mode.
<telerik:RadGrid ID="RadGrid1" |
Skin="Vista" |
runat="server" |
Width="1050" |
GridLines="None" |
AllowAutomaticInserts="false" |
AutoGenerateColumns="False" |
AllowMultiRowSelection="False" |
AllowSorting="False" |
AllowPaging="False" |
OnItemCommand="RadGrid1_ItemCommand" |
OnItemCreated="RadGrid1_ItemCreated" |
OnUpdateCommand="RadGrid1_UpdateCommand" |
OnNeedDataSource="RadGrid1_NeedDataSource" |
OnItemDataBound="RadGrid1_ItemDataBound" |
ShowStatusBar="true" |
OnDeleteCommand="RadGrid1_DeleteCommand"> |
<PagerStyle Mode="NumericPages"></PagerStyle> |
<MasterTableView DataKeyNames="Id" AllowMultiColumnSorting="True" EditMode="InPlace" CommandItemStyle-Height="28px" CommandItemDisplay="Top"> |
<CommandItemTemplate> |
<table style="width:100%"> |
<tr> |
<td> |
<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="./Images/Edit.gif" />Edit selected route</asp:LinkButton> |
<asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="./Images/Update.gif" />Update</asp:LinkButton> |
<asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="./Images/Cancel.gif" />Cancel editing</asp:LinkButton> |
<asp:LinkButton ID="btnInitInsert" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="./Images/AddRecord.gif" />Add new route</asp:LinkButton> |
<asp:LinkButton ID="btnInsert" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="./Images/Insert.gif" /> Add route</asp:LinkButton> |
<asp:LinkButton ID="btnDeleteSelected" runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="./Images/Delete.gif" />Delete selected route</asp:LinkButton> |
</td> |
<td style="text-align:right;"><asp:LinkButton ID="btnRefresh" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="./Images/Refresh.gif" />Refresh</asp:LinkButton></td> |
</tr> |
</table> |
</CommandItemTemplate> |
<Columns> |
<telerik:GridBoundColumn UniqueName="Id" DataField="Id" ReadOnly="true" Visible="false" /> |
<telerik:GridTemplateColumn UniqueName="TemplateColumn" ItemStyle-Width="30px" HeaderText=""> |
<ItemTemplate> |
<asp:Panel ID="Panel1" runat="server"> |
<asp:CheckBox ID="Enabled" runat="server" AutoPostBack="true" Checked='<%# Eval("Enabled") %>' OnCheckedChanged="EnabledChanged" /> |
</asp:Panel> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridTemplateColumn UniqueName="TemplateColumn" ItemStyle-Width="50px" HeaderText="Metabolite" HeaderStyle-HorizontalAlign="Center"> |
<ItemTemplate> |
<asp:Panel ID="Panel2" runat="server" HorizontalAlign="Center"> |
<asp:CheckBox ID="Metabolite" runat="server" AutoPostBack="true" Checked='<%# Eval("Metabolite") %>' /> |
</asp:Panel> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridDropDownColumn UniqueName="Pathway" ItemStyle-Width="170px" ListTextField="PathwayName" ListValueField="Pathway" ListDataMember="Pathways" DataField="Pathway" HeaderStyle-HorizontalAlign="Left" HeaderText="Pathway" DropDownControlType="RadComboBox" /> |
<telerik:GridDropDownColumn UniqueName="Enzyme" ItemStyle-Width="170px" ListTextField="EnzymeName" ListValueField="Enzyme" ListDataMember="KineticEnzymes" DataField="Enzyme" HeaderStyle-HorizontalAlign="Left" HeaderText="Enzyme" DropDownControlType="RadComboBox" /> |
<telerik:GridTemplateColumn UniqueName="TemplateColumn" ItemStyle-Width="5px" ItemStyle-HorizontalAlign="Center" HeaderText=""> |
<ItemTemplate> |
<asp:Panel ID="Panel3" runat="server"> |
<asp:CheckBox ID="ClintVmaxSwitch" runat="server" Checked='<%# Eval("ClintVmaxSwitch") %>' AutoPostBack="true" OnCheckedChanged="ClintVmaxSwitchChanged" /> |
</asp:Panel> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn UniqueName="CLint" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" DataField="CLint" HeaderText="CLint" HeaderStyle-HorizontalAlign="Center" /> |
<telerik:GridBoundColumn UniqueName="VMax" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" DataField="VMax" HeaderText="Vmax" HeaderStyle-HorizontalAlign="Center" /> |
<telerik:GridBoundColumn UniqueName="KmKs" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" DataField="KmKs" HeaderText="Km(Ks)" HeaderStyle-HorizontalAlign="Center" /> |
<telerik:GridBoundColumn UniqueName="fumic" ItemStyle-Width="50px" DataFormatString="{0:N3}" ItemStyle-HorizontalAlign="Center" DataField="fumic" HeaderText="fumic" HeaderStyle-HorizontalAlign="Center" /> |
<telerik:GridTemplateColumn UniqueName="TemplateColumn" ItemStyle-Width="5px" ItemStyle-HorizontalAlign="Center" HeaderText=""> |
<ItemTemplate> |
<asp:Panel ID="Panel4" runat="server"> |
<asp:CheckBox ID="SystemEnabled" runat="server" AutoPostBack="true" Checked='<%# Eval("SystemEnabled") %>' OnCheckedChanged="SystemEnabledChanged" /> |
</asp:Panel> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridDropDownColumn UniqueName="System" ItemStyle-Width="170px" ListTextField="rCYPsystemName" ListValueField="System" ListDataMember="rCYPsystems" DataField="System" HeaderText="rCYP system" HeaderStyle-HorizontalAlign="Left" DropDownControlType="RadComboBox" /> |
<telerik:GridBoundColumn UniqueName="Value" DataField="Value" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" HeaderText="ISEF" HeaderStyle-HorizontalAlign="Center" /> |
<telerik:GridTemplateColumn UniqueName="TemplateColumn" ItemStyle-Width="5px" ItemStyle-HorizontalAlign="Center" HeaderText=""> |
<ItemTemplate> |
<asp:Panel ID="Panel5" runat="server"> |
<asp:CheckBox ID="bATypicalSwitch" runat="server" AutoPostBack="true" Checked='<%# Eval("bATypicalSwitch") %>' OnCheckedChanged="bATypicalSwitchChanged" /> |
</asp:Panel> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn UniqueName="Alpha" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" DataField="Alpha" HeaderText="α" HeaderStyle-HorizontalAlign="Center" /> |
<telerik:GridBoundColumn UniqueName="Beta" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center" DataField="Beta" HeaderText="β" HeaderStyle-HorizontalAlign="Center" /> |
</Columns> |
<EditFormSettings CaptionFormatString="Edit details for route with Id {0}" CaptionDataField="Id"> |
<FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle> |
<FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle> |
<FormStyle Width="100%" BackColor="#eef2ea"></FormStyle> |
<EditColumn ButtonType="ImageButton" /> |
</EditFormSettings> |
</MasterTableView> |
<ClientSettings> |
<Selecting AllowRowSelect="True" EnableDragToSelectRows="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
protected void EnabledChanged(object sender, System.EventArgs e) |
{ |
//first reference the panel which wraps the checkbox control through the Parent property |
CheckBox chkBox = (sender as CheckBox); |
// Do something |
} |
Each checkbox has it's own OncheckedChanged event handler which enables/disables various columns. There seems to be a problem around when the event handler gets triggered. If you put a breakpoint within the event handler the run the app. When in the grid edit mode, if you check any checkbox the event handler triggers, if you uncheck it again it does not trigger the event handler. It seems like only half the functionality has been implemented. I have tried many different ways including using checkbox columns instead of using your panels method and adding the autopostback and event handler programatically, auto-generating columns but it still only seems to fire the OnCheckedChanged event in one direction. I have looked through your knowledgebase/forums without joy. Any help appreciated.