繁体   English   中英

从自定义用户控件更新contenttemplate下页面中控件的ID?

[英]Update id of a control in a page under contenttemplate from a custom user control?

我的共享点页面中有一个控件

    <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
<SharePointWebControls:UIVersionedContent UIVersion="4" runat="server">
    <ContentTemplate>
        <asp:Literal runat="server" id="Literal1" text="" visible="false"></asp:Literal>



    i am trying to access this literal1 from a usercontrol and change the text value of this control or change the ID value of  this control. 

我试过这个来更新DIV控件的ID,但是没有用。 这是用户控件的一部分。

      HtmlGenericControl control = (System.Web.UI.HtmlControls.HtmlGenericControl)this.Page.FindControl("literal");
        if (control != null)
        {
            control.Attributes.Clear();
            control.Attributes.Add(ID,divid);
            //control.Text = divid.ToString();
            //document.getElementById('var_div').setAttribute('id',val)

        }

任何想法它如何工作的人

文字无用。 尝试改用Label。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM