如何获取在MasterPage ContentPlaceHolder中加载的Content ID [英] How to Get Content ID loaded in MasterPage ContentPlaceHolder

查看:67
本文介绍了如何获取在MasterPage ContentPlaceHolder中加载的Content ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法获取加载到母版页PlaceHolder中的Content元素的元素ID?

对于EX:我的母版页,

is there a way to get element ID of an Content element loaded in the master page PlaceHolder?

For EX: My master page,

<form id="form1"  runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

        
    </div>
    </form>



以下是使用母版页的其他页:



Below is Other Page using Master page:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
I am the child page
<asp:Label ID="lbl" runat="server"></asp:Label>
</asp:Content>



如何在Master PageLoad中获取Content ID("Content2").

有人可以建议吗?

在此先谢谢您.



how to get the Content ID ("Content2") in Master PageLoad.

Can Any one please suggest.

Thanks in advance.

推荐答案

看看这个
HAve a look at this link.[^]

Long story short;
(MyUserControl)Page.Controls[0].FindControl("ucMyUserControl");



祝你好运.



Good luck.


这篇关于如何获取在MasterPage ContentPlaceHolder中加载的Content ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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