有什么办法可以找到母版页的控件 [英] is there any way to findout the control of master page

查看:90
本文介绍了有什么办法可以找到母版页的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以找到不是由母版页创建的aspx页上的母版页控件(意味着样本aspx页)::叹气:

is there any way to findout the control of master page on aspx page that is not created by master page (means thatis sample aspx page) :sigh:

推荐答案

您的问题很难破译,但我会尝试的.

如果您的意思是,您可以从asp.net子页面上引用母版页上的控件吗,是的,您可以.

您可以尝试,例如:

Label label = (Label)Parent.FindControl("Label1")


或者您可以用Master代替Parent,具体取决于您从哪里和向哪里打电话.如果控件是嵌套的,则可能还必须扩展呼叫.如果那完全是垃圾,那么您需要澄清您的问题.
You''re question is difficult to decipher but I''ll have a try.

If you mean, can you reference a control on a master page from an asp.net child page then, yes, you can.

You could try, for instance:

Label label = (Label)Parent.FindControl("Label1")


or you might substitute Master for Parent depending upon where you are calling from and to. You may also have to extend the call if the control is nested. If that is total rubbish then you''ll need to clarify your question.


您可以使用内容页面中的Master对象,

如何:参考ASP.NET母版页内容 [
You can use Master object from content page,

How to: Reference ASP.NET Master Page Content[^]


您可以控制母版页(如果您可以访问该母版页或该母版页内容的任何其他页).

由于当前的ASPX页面未使用任何MasterPage,因此您将无法直接访问它.

顺便说一句,这是什么情况?当然有一些糟糕的设计案例,或者还有另一种选择可以做您实际想要做的事情.
最好是使用场景的详细信息正确地更新问题,然后尝试.
You can get control of the Master Page if you can access the page or any other page that is a content of that master page.

Since current ASPX page is not using any MasterPage, you won''t be able to access it directly.

BTW, what kind of scenario is this? Surely some bad design case or there would be another option to do what actually you are trying to do.
Better would be to update the question properly with details of your scenario and then try out.


这篇关于有什么办法可以找到母版页的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆