UserControl disappear after postback

3 posts, 0 answers
  1. Danny
    Danny avatar
    29 posts
    Member since:
    Feb 2012

    Posted 02 Feb 2012 Link to this post

    Hi,

    I'm having a problem with a UserControl inside a RadPanelBar. The PanelBar is nested inside an UpdatePanel (although it reacts the same if I remove it).

    <telerik:RadPanelBar runat="server" ID="pnlBar" Width="100%" ExpandMode="SingleExpandedItem" OnClientLoad="PanelBarLoad">
            <Items>
              <%--Panel::Member--%>
              <telerik:RadPanelItem>
                <HeaderTemplate>
                  Member </HeaderTemplate>
                <ContentTemplate>
                  <asp:LinkButton runat="server" CommandName="_memberClicked" OnCommand="ShowReport_Command">
                    <h1>
                      <asp:Literal ID="litMemberName" Text="" runat="server" />
                    </h1>
                  </asp:LinkButton>
                  <cc:LinkButton ID="myTest" runat="server" IgnorePermission="true" CommandName="_memberClicked" OnCommand="ShowReport_Command">
                      $ <asp:Literal ID="litMemberRevenue"  Text="" runat="server" />
                  </cc:LinkButton>
                </ContentTemplate>
              </telerik:RadPanelItem>
    ....

    After a PostBack, the default ASP:LinkButton is still visible, the custom control LinkButton disappears. 

    My custom LinkButton is a simple as the following:
      [ToolboxData("<{0}:LinkButton runat=\"server\"></{0}:LinkButton>")]
      public class LinkButton: System.Web.UI.WebControls.LinkButton {
        private bool _ShowLoadingMessage = true;
        public bool ShowLoadingMessage {
          get { return _ShowLoadingMessage; }
          set { _ShowLoadingMessage = value; }
        }
     
        protected override void OnPreRender(EventArgs e) {
          base.OnPreRender(e);
     
          //add loading client click, only if not added before
          if (ShowLoadingMessage) {
            if (!this.OnClientClick.Contains("mn_ShowLoadingMessage();")) {
              this.OnClientClick = this.OnClientClick.Insert(0, "mn_ShowLoadingMessage();");
            }
          }
        }
      }

    Any ideas?

    Thanks
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 08 Feb 2012 Link to this post

    Hello Danny,

    We couldn't replicate the issue with the information you provided. Please, open a support ticket and send us a simple demo of the problem.

    Kind regards,
    Peter
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Danny
    Danny avatar
    29 posts
    Member since:
    Feb 2012

    Posted 09 Feb 2012 Link to this post

    Hi Peter,

    I've just tried to reproduce the issue in a new, empty webproject. Unfortunately, it works just fine in here. So I'm guessing I'm doing something wrong. Last week I changed the custom LinkButton to the normal LinkButton so that I could work normally with it. I've just changed back to the custom LinkButton, and it doesn't disappear anymore...

    I have absolutely know idea what I've changed and why it's working correctly now..
Back to Top