This is a migrated thread and some comments may be shown as answers.

UserControl disappear after postback

2 Answers 83 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 02 Feb 2012, 05:26 PM
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 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 08 Feb 2012, 11:50 AM
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 >>
0
Danny
Top achievements
Rank 1
answered on 09 Feb 2012, 09:39 AM
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..
Tags
PanelBar
Asked by
Danny
Top achievements
Rank 1
Answers by
Peter
Telerik team
Danny
Top achievements
Rank 1
Share this question
or