如何在FormView ItemTemplate中查找控件
问题描述:
我正在尝试在formview中找到gridview控件
看起来我在formview中找到了控件但是我无法绑定
数据来了来自数据集
I am trying to find the gridview control placed in formview
It looks like i have found the control in formview but I am not able to bind the
data coming from the dataset
GridView gvSizePrice = (GridView)fvProduct.FindControl("gdvSizePrice");
gvSizePrice.DataSource = ds;
gvSizePrice.DataBind();
可以帮助
can some one help
答
尝试
try
fvProduct.Row.FindControl("gdvSizePrice");
谢谢,
Hemant
Thanks,
Hemant
更加动态(在FormView事件中,如DataBound):
GridView gv =(GridView)((FormView)发送者).Row.FindControl(GridView1);
A little more dynamic (when in a FormView event, like DataBound):
GridView gv = (GridView)((FormView)sender).Row.FindControl("GridView1");