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

How to find out nested control

1 Answer 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shabbir
Top achievements
Rank 1
Shabbir asked on 14 Jan 2009, 06:03 AM
HI ALL,
 Help plz, can I find out their nested controls. I want this, see below.

 

protected void AD_View_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

    if (e.CommandName == "ExpandCollapse")

 

    {

 

 

        GridDataItem item = (GridDataItem)e.Item;

 

        item.Selected =

true;

 

 

        string strkey = item.GetDataKeyValue("AD_ID").ToString();

 

 

        this.Title = this.Title + strkey + " Mode(Expand): " + ((item.Expanded) ? false : true) ;

 

 

        Label lbl = (Label)item.FindControl("lblRowNumber");

 

        
        //EDR_View this is nested grid
        RadGrid grdEDR_View = (RadGrid)item.FindControl("EDR_View");
        if (grdEDR_View != null)
        {
            grdEDR_View.DataSource = GET_EDR_Records(strkey);
        }


    }

 

}

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 14 Jan 2009, 08:02 AM
Hello Shabbir,

I suppose you are using a NestedViewTemplate with a grid in it. If so, try out the following code to access the grid in the NestedViewTemplate:
cs:
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
       if (e.CommandName == "ExpandCollapse") 
         { 
            GridDataItem item = (GridDataItem)e.Item;            
                    foreach (GridNestedViewItem item1 in RadGrid1.MasterTableView.GetItems(GridItemType.NestedView)) 
                    { 
                         RadGrid grid = (RadGrid)item1.FindControl("EDR_View"); 
                
                    } 
          } 
      } 

Thanks
Princy.
Tags
Grid
Asked by
Shabbir
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or