[英]Use usercontrol id of ascx page in aspx page
我有一个用户控件。该用户控件包含在母版页中。现在,我还有另一个页面是aspx页.aspx页正在继承母版页。
So you have no direct relation of aspx page with the usercontrol page.In such case make a public function in the master page of type usercontrol 因此,您没有aspx页面与usercontrol页面的直接关系。在这种情况下,请在usercontrol类型的母版页中启用公共功能
public yourusercontrol getucID()
{
return usercontrol_id
}
Now you can use this function to get usercontrol id in your aspx.cs page. 现在,您可以使用此功能在aspx.cs页面中获取用户控件ID。
yourmaster mst = (yourmaster)Page.Master;
yourusercontrol yuc = mst.getucID();
//Now do your stuff with yuc
I hope it Helps 希望对您有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.