如何取到一个控件父级中某一控件的值
DataGrid1中一个Lable1= "123 "
DataGrid2中有个LinkButton1
DataGrid1中嵌套了DataGrid2
DataGrid2帮定后有3条数据,点LinkButton1能取到0 1 2
要怎么样,才能取Lable1中的123那?
for(int i = 0 ; i < DataGrid1.Items.Count ; i ++ )
{
dg = (DataGrid)DataGrid1.Items[i].FindControl( "DataGrid2 ");
dg.ItemCommand+=new DataGridCommandEventHandler(dg_ItemCommand);
}
private void dg_ItemCommand(object source, DataGridCommandEventArgs e)
{
label lb =(Label)e.Item.Parent.Parent.FindControl( "Label1 ")?
lb.Text= "123 "???
)