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

access detail grid from CommandItemTemplate

2 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kieran
Top achievements
Rank 1
kieran asked on 27 Jul 2009, 05:33 PM
hi

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


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

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?


Thanks
Kieran

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Jul 2009, 04:31 AM
Hi Kieran,

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

CS:
 
 
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 
            } 
        } 
    } 


Thanks
Shinu
0
donoho
Top achievements
Rank 1
answered on 24 Feb 2010, 07:06 PM
Thanks Shinu,

That code snippet helped bridge a Very frustrating gap in accessing column data from the CommandItemTemplate.
Tags
Grid
Asked by
kieran
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
donoho
Top achievements
Rank 1
Share this question
or