问题描述
我无法访问包含母版页的页面中的用户控件中的控件。
我有一个主页A.Master
我有一个包含母版页的A.aspx页面
在A.aspx中我有一个名为Save&的按钮。一些用户控件,如myusercontrol1,myusercontrol2等...
当我点击保存按钮时,我需要访问该用户控件中的控件。得到的价值。
我尝试过:
i在web.config文件中注册了这些用户控件。
i解除了保存按钮&的点击事件。编写以下代码
myusercontrol1 obj = new myusercontrol1()
Gridview grvuserdetails =(Gdidview)obj.findcontrol(GridView1)。
但是价值在obj& grvuserdetails变为null。
I cant't access the Controls Present In A User Control In A Page Which Includes Master Page.
I Have A Masterpage A.Master
I Have A Page A.aspx which include masterpage
In A.aspx i have a button named Save & Some Usercontrols like myusercontrol1,myusercontrol2 etc...
I need that when i click the save button i want to access the controls present in that user controls & get the value present in.
What I have tried:
i registered those usercontrols in web.config file.
i fired the click event of save button & write the following code
myusercontrol1 obj = new myusercontrol1()
Gridview grvuserdetails=(Gdidview)obj.findcontrol("GridView1").
But The Value In obj & grvuserdetails becomes null.
这篇关于查找页面中用户控件中存在的控件,包括母版页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!