[英]How to find dropdown selected value inside repeater in dropdown selected index change event?
[英]Find control of child gridview in a dropdown selected index change event
我有两个gridview Gv1是父级,而gv2嵌套在Gv1内,我想找到子gridview的控件以及放置在dropgrilist的selectedindexchange中childgridview的itemtemplate内的标签,该标签位于两个列表之外网格
我已经在下拉选中的索引更改中使用了此代码
GridView grid_child = grv_parent.FindControl("grv") as GridView;
if (grid_child != null)
{
Label lbl_asset_type = (Label)grid_child.FindControl("lbl_asset_type");
我认为您想要一个ID为“ lbl_asset_type”的标签,该标签位于父网格内的子网格内。 可能存在语法错误,但是请尝试以下操作(我尚未测试代码,但这应该可以为您提供一个总体思路):
GridView grid_child = grv_parent.FindControl("grv") as GridView;
if (grid_child != null)
{
foreach (GridViewRow row in grid_child.Rows)
{
Label lblAssetType = (Label)grid_child.FindControl("lbl_asset_type");
//Use label here. Make sure to do a null check first
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.