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

Accessing detail grid columns

2 Answers 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CBARS
Top achievements
Rank 2
CBARS asked on 23 Sep 2008, 11:40 AM
Hi

I'm currently iterating through the master table columns like this :

protected void RadGrid1_DataBound(object sender, EventArgs e) 
        { 
            foreach (Telerik.Web.UI.GridItem griditem in RadGrid1.MasterTableView.Items) 
            { 
                griditem.Cells[ColNumber].Text  
            } 
        } 

I'm doing this to change each seperate cell to a specific number format, and chopping off the time on date values.

How can I also iterate through the currently expanded detail tables' columns to do the same?


2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 23 Sep 2008, 12:44 PM
Hi,

You can loop through the expanded detail tables as shown in code below.
cs:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.Items) 
        { 
            if (item.Expanded) 
            { 
                GridTableView nestedView = ((GridDataItem)item).ChildItem.NestedTableViews[0]; 
                foreach (GridDataItem childitem in nestedView.Items) 
                { 
                     string strtxt=childitem["ColumnUniqueName"].Text; 
                }   
               
            } 
        } 
   } 

Thanks
Princy.
0
CBARS
Top achievements
Rank 2
answered on 23 Sep 2008, 02:09 PM
Sorted. Thanks.
Tags
Grid
Asked by
CBARS
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
CBARS
Top achievements
Rank 2
Share this question
or