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

findcontrol in DetailTable row and MasterTable row

4 Answers 340 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Farshad heidary
Top achievements
Rank 1
Farshad heidary asked on 09 Feb 2010, 02:55 PM
hu guys
how i can search(findcontrol) in rows in DetailTable and MaSter Table?
for ex in grid view : foreach(GridViewRow gr in Grid1.Rows) ...
in Rad how i can?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Feb 2010, 03:09 PM
Hi,

You can refer to the link below to know more on how to traverse the detail tables/items in RadGrid.Use the logic to ac

Traversing detail tables/items in Telerik RadGrid

Thanks,
Princy
0
Farshad heidary
Top achievements
Rank 1
answered on 09 Feb 2010, 05:01 PM
for (int i = 0; i < RadGrid1.MasterTableView.Items.Count; i++) 
        { 
            GridDataItem NestedDataItem = RadGrid1.MasterTableView.Items[i]; 
            Label lbl = (Label)NestedDataItem.FindControl("lblID"); 
        } 
tnx 4 ur help and attention.
it's very good but i can't do :
find a element in Detail table!

have u any full sample?
wanna find a Detail Table's Element in DataBound event.
i do in MasterTableView but cant do in Detail table
like : Like sample code..

tnx dude


0
Farshad heidary
Top achievements
Rank 1
answered on 10 Feb 2010, 12:16 PM
sorry support team
can you help me?
it's emergency
tnx
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Feb 2010, 05:04 AM
Hi,

You can use the Name property to  differentiate between the MasterTable and DetailTable. Try the code snippet below:

C#
 protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "MasterTable"
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
        } 
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "DetailTable"
        { 
            GridDataItem childItem = (GridDataItem)e.Item; 
            //To find the parentItem of the child 
            GridDataItem parentItem = (GridDataItem)childItem.OwnerTableView.ParentItem; 
        } 
 
    } 

Hope this helps.

Thanks,
Princy
Tags
Grid
Asked by
Farshad heidary
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Farshad heidary
Top achievements
Rank 1
Share this question
or