如何从asp.net中的用户控件(.ascx)页面访问.aspx页面 [英] how to access the .aspx page from the user control(.ascx) page in asp.net

查看:210
本文介绍了如何从asp.net中的用户控件(.ascx)页面访问.aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个母版页,我定义了controlplaceholder

< asp:controlplaceholder id =controlplaceholder1runat =server>



和我确实有about.aspx页面定义如下

< asp:content id =content1contentplaceholder id =controlplaceholder1runat =server>< asp:content> ;





和我的用户控制(.ascx)文件如下



其中.aspx webform页面是从母版页继承但我无法访问.aspx页面。 ascx用户控制页面该怎么办?请帮帮我

解决方案

你可以使用 this.Parent.FindControl()方法。您可以在下一个链接中找到有关此内容的详细信息:

http://forums.asp.net/t/1307006.aspx?How+to+Access+Parent+Page+aspx+control+IDs +来自+其+儿童+用户+控制+ ascx + [ ^ ]

http://msdn.microsoft.com/en-us/library/31hxzsdw(v=vs.110)。 aspx [ ^ ]

i have a master page and i define controlplaceholder
<asp:controlplaceholder id="controlplaceholder1" runat="server">

and i do have about.aspx page define as follows
<asp:content id="content1" contentplaceholder id="controlplaceholder1" runat="server"><asp:content>


and my user control(.ascx) file is as below


where .aspx webform page is inherit from master page but i cannot access .aspx page from .ascx user control page what should i do?? please help me

解决方案

You could use this.Parent.FindControl() method. You could find details about this in the next links:
http://forums.asp.net/t/1307006.aspx?How+to+Access+Parent+Page+aspx+control+IDs+from+its+child+User+Control+ascx+[^]
http://msdn.microsoft.com/en-us/library/31hxzsdw(v=vs.110).aspx[^]


这篇关于如何从asp.net中的用户控件(.ascx)页面访问.aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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