This is a migrated thread and some comments may be shown as answers.

Test Post

1 Answer 19 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Reid asked on 16 Feb 2009, 02:07 PM
Why is the server still down?  When I post the content below the server bombs :

Title: Custom <CommandTemplate> when using a custom <ItemTemplate>
Message : 

Using an ajaxified RadGrid (latest and greatest version) I have implemented a custom Command Template to facilitate add, edit, insert, update, and cancel actions based on demos here.

This works fine but does not work for editing or deleting if you are using a custom <ItemTemplate>.  I say this because as such it relies on a "selected" row or item in the grid. I have the code to select the row on the client side but cannot figure out how to display or enact the selected row when using the custom <ItemTemplate>.

So the questions are:

  1. How does the selected row strategy work with custom ItemTemplates?
  2. As an alternative, are there any examples of showing two small columns side by side with icons only for the AutoGenerated "Edit" and "Delete" columns instead of the default?

Thank you

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 19 Feb 2009, 08:44 AM
Hi Reid,

Basically, building a custom command item relies on having the proper command names for the buttons, which are expected to raise a specific command - put an item in edit mode, cancel, refresh, etc. The code snippet below demonstrates one setup:

                    <div style="padding: 0 5px;">  
                        Custom command item template&nbsp;&nbsp;&nbsp;&nbsp;  
                        <asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Edit.gif" />Edit selected</asp:LinkButton>&nbsp;&nbsp;  
                        <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Update.gif" />Update</asp:LinkButton>&nbsp;&nbsp;  
                        <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="../../DataEditing/Img/Cancel.gif" />Cancel editing</asp:LinkButton>&nbsp;&nbsp;  
                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/AddRecord.gif" />Add new</asp:LinkButton>&nbsp;&nbsp;  
                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Insert.gif" /> Add this Customer</asp:LinkButton>&nbsp;&nbsp;  
<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')" 
runat="server" CommandName="DeleteSelected"><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Delete.gif" />Delete selected customers</asp:LinkButton>&nbsp;&nbsp;  
                        <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="../../DataEditing/Img/Refresh.gif" />Refresh customer list</asp:LinkButton> 

I hope this gets you started properly.

All the best,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question