简体   繁体   English

在aspx页面中使用ascx页面的用户控件ID

[英]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.

相关问题 如何从aspx页面访问用户控件ID? - How to access usercontrol id from the aspx page? 将usercontrol添加到aspx页面 - adding usercontrol to aspx page 如何使用Server.Transfer()将文本框值从usercontrol(ascx)传递到另一个页面(aspx) - How can I pass textbox value from usercontrol(ascx) to another page (aspx) using Server.Transfer() 如何从main.aspx页面的代码后面访问usercontrol.ascx中的字段集? - how to access fieldset in usercontrol.ascx from codebehind of the main.aspx page? 在aspx页面中加载不同的ascx - Load different ascx's in aspx page 如何在单个asx页面中使用列表框和下拉列表并在aspx页面中访问它 - How to use a listbox and dropdown list in a single ascx page and access it an aspx page 从.aspx访问.ascx中的.aspx页面Ajax TabContainer - Access .aspx Page Ajax TabContainer in .ascx from .aspx 访问在aspx中的aspx.cs中声明的变量或在ascx.cs ascx页面中声明的变量 - Accessing variable declared in aspx.cs in aspx or variable declared in ascx.cs ascx page 如何只验证一个.aspx页中的一个.ascx页,而其他.ascx页也都注册在同一.aspx页中? - How to validate only one .ascx page in an .aspx page while other .ascx pages also registered in the same .aspx page? 如何将一个ascx事件从动态加载的ascx页面连接到aspx页面中? - How do I wire an ascx event from a dynamically loaded ascx page into the aspx page…?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM