问题描述
亲爱的所有人:),
我有一个问题,在我的项目中,我有一个母版页,其中有一个像linkbuton这样的控件,问题是我想获取linkbutton id来仅连接aspx代码(而不是后面的代码).如何从母版页获取控件ID ...您能帮助任何一个人吗
谢谢你,
Eshwar.V
Dear All :) ,
i Have some issue, in my project i have one master page in that one control like linkbuton, the thing is i want to get linkbutton id to contect aspx code only (not in code behind). how to get control id from master page...can u plz help any one
Thank u,
Eshwar.V
推荐答案
LinkButton lbMaster = Master.FindControl("myLinkButton1") as LinkButton;
阅读:如何:参考ASP.NET母版页内容 [ ^ ]
现在,进入第二部分:在Content aspx页面中获取ID.
最简单的方法是在内容页面加载中找到以上链接按钮.在Content Designer中,请先保留一个虚拟链接按钮,然后在获得主链接按钮后再将其分配给内容链接"按钮.
Read: How to: Reference ASP.NET Master Page Content[^]
Now, to your second part: to get ID in Content aspx page.
Simplest would be to find the above link button in your content page load. Keep a dummy linkbutton from before in Content designer and after getting master link button assign it to the Content link button.
这篇关于如何从母版页控件获取以连接aspx页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!