开发者

Access User Control DataGrid Controls from parent page

开发者 https://www.devze.com 2023-02-12 02:23 出处:网络
here my code- GridView gvCondition = (GridView)this.FindControl(\"ucCondition\").FindControl(\"g开发者_高级运维vCondition\");

here my code-

GridView gvCondition = (GridView)this.FindControl("ucCondition").FindControl("g开发者_高级运维vCondition");
gvCondition.DataSource = objConditionFieldCollection;
gvCondition.DataBind();

but it is throwing as exception Object reference not set to an instance of an object.How can I access user control's gridview control from parent page?


I don't know where you trying to access the UserControl's GridView, but why don't you simply expose a public property in the UserControl that returns the GridView(f.e. ConditionView)?

0

精彩评论

暂无评论...
验证码 换一张
取 消