access detail grid from CommandItemTemplate

3 posts, 0 answers
  1. kieran
    kieran avatar
    19 posts
    Member since:
    Jul 2006

    Posted 27 Jul 2009 Link to this post


    I have following
     <telerik:RadGrid ID="RadGrid1"

              . {columns here}
                  <div style="text-align:right;">
                    <asp:Button ID="LinkButton6" runat="server"
                        CommandName="SetSelected" text="Set"                    CausesValidation="false"/>

    I need to react to the command here and iterate through all item in the sub grid that the command template belongs to. How do I get access and what method is it - the itemcommand on the main grid and filter by command name?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jul 2009 Link to this post

    Hi Kieran,

    Try the following code snippet to loop through the child table rows in the ItemCommand event.

    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
            if (e.CommandName == "SetSelected"
                GridTableView childtable = (GridTableView)e.Item.OwnerTableView; 
                foreach (GridDataItem childItem in childtable.Items) 
                 //loop through the detail table rows here 

  3. donoho
    donoho avatar
    21 posts
    Member since:
    Apr 2007

    Posted 24 Feb 2010 Link to this post

    Thanks Shinu,

    That code snippet helped bridge a Very frustrating gap in accessing column data from the CommandItemTemplate.
Back to Top