Hello,
I have a requirement as follows,
I need to disable rad Grid Edit button If I am click on Edit and It needs to be enable when update/cancel click. Please find the attached screen shot.
Here I am using GridEditCommandColumn and EditFormSettings for edit form.
Please give your valuable suggestions.
Regards,
Prasad.
I have a requirement as follows,
I need to disable rad Grid Edit button If I am click on Edit and It needs to be enable when update/cancel click. Please find the attached screen shot.
Here I am using GridEditCommandColumn and EditFormSettings for edit form.
Please give your valuable suggestions.
Regards,
Prasad.
4 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 Jan 2014, 07:42 AM
Hi Prasad,
Please try the following code snippet to disable the Edit button in EditMode:
ASPX:
C#:
Thanks,
Princy
Please try the following code snippet to disable the Edit button in EditMode:
ASPX:
<telerik:GridEditCommandColumn UniqueName="GridEditCommandColumn"></telerik:GridEditCommandColumn>C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e){ if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem edit = (GridEditableItem)e.Item; edit["GridEditCommandColumn"].Enabled = false; }}Thanks,
Princy
0
Prasad
Top achievements
Rank 1
answered on 20 Jan 2014, 11:25 AM
thanq princy.
0
Prasad
Top achievements
Rank 1
answered on 21 Jan 2014, 07:55 AM
Hi Princy,
I used ur code snippet but I am getting error In my error Log as follows.
Cannot find a cell bound to column name 'GridEditCommandColumn'
My source code snippet Is:
I used ur code snippet but I am getting error In my error Log as follows.
Cannot find a cell bound to column name 'GridEditCommandColumn'
My source code snippet Is:
<telerik:RadGrid ID="rgvLang" runat="server" AutoGenerateColumns="false" OnNeedDataSource="rgvLang_NeedDataSource" OnItemCommand="rgvLang_ItemCommand" OnItemDataBound="rgvLang_ItemDataBound"> <MasterTableView AutoGenerateColumns="false" DataKeyNames="LanguageID"> <Columns> <telerik:GridBoundColumn HeaderText="LanguageId" Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left"> </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="Language" DataField="LanguageDescription" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"> </telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="Display Name" DataField="Text" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" UniqueName="Text" ItemStyle-Wrap="true"> </telerik:GridBoundColumn> <telerik:GridEditCommandColumn UpdateText="Update" CancelText="Cancel" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left"> </telerik:GridEditCommandColumn> </Columns> <EditFormSettings EditFormType="Template"> <EditColumn UniqueName="LanguageId"> </EditColumn> <FormTemplate> <div class="row-fluid data-fields"> <div class="span12" style="padding-left: 2%;"> <div class="span4" style="text-align: left;"> <asp:Label ID="lblLanguage" runat="server" CssClass="span" Text="Language"></asp:Label> <telerik:RadTextBox runat="server" ID="rtbLangValue" Text='<%# Eval("LanguageDescription") %>' Enabled="false"> </telerik:RadTextBox> </div> <div class="span6" style="text-align: left;"> <asp:Label ID="lblDispalyName" runat="server" CssClass="span" Text="Display Name"></asp:Label> <telerik:RadTextBox ID="lblLangDisplayText" runat="server" Text='<%# Eval("Text") %>' TextMode="MultiLine" Width="96%"> </telerik:RadTextBox> <asp:CustomValidator ID="cvPaCreate" runat="server" OnServerValidate="cvPaCreateGrid_Validate" Display="None" ValidationGroup="PaCreateGrid"> </asp:CustomValidator> <asp:CustomValidator ID="cvPaCreateCancel" runat="server" OnServerValidate="cvPaCreateGridCancel_Validate" Display="None" ValidationGroup="PaCreateGridCancel"> </asp:CustomValidator> </div> </div> <div class="span12" style="width: 96%; padding-bottom: 5px;"> <div class="pull-right"> <telerik:RadButton ID="rdbtnUpdate" Text="Update" runat="server" OnClick="rdbtnUpdate_Click" ValidationGroup="PaCreateGrid" ToolTip="Update"> </telerik:RadButton> <telerik:RadButton ID="rdbtnCancel" Text="Cancel" runat="server" OnClick="rdbtnCancel_Click" ValidationGroup="PaCreateGridCancel" ToolTip="Cancel"> </telerik:RadButton> </div> </div> </div> </FormTemplate> </EditFormSettings> </MasterTableView> </telerik:RadGrid>0
Princy
Top achievements
Rank 2
answered on 21 Jan 2014, 09:06 AM
Hi Prasad,
You haven't set the UniqueName for your GridEditCommandColumn, in the code behind its accessed using its UniqueName :
ASPX:
Thanks,
Princy
You haven't set the UniqueName for your GridEditCommandColumn, in the code behind its accessed using its UniqueName :
ASPX:
<telerik:GridEditCommandColumn UniqueName="GridEditCommandColumn" UpdateText="Update" CancelText="Cancel" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" ></telerik:GridEditCommandColumn>Thanks,
Princy