PageViewCreated doesn't fire

3 posts, 0 answers
  1. Denise
    Denise avatar
    5 posts
    Member since:
    Nov 2011

    Posted 07 Nov 2012 Link to this post

    Hi all,

    I'm having a problem with PageViewCreated either not firing at all or firing too often.  My markup is this:

    <telerik:RadTabStrip ID="rtsReturns" runat="server" MultiPageID="rmpReturns" OnTabClick="rtsReturns_TabClick">
             <telerik:RadTab runat="server" Text="Current Returns" Value="Current"></telerik:RadTab>
      <telerik:RadMultiPage id="rmpReturns" runat="server" SelectedIndex="0" Width="400">
       <telerik:RadPageView id="pgvwCurrent" runat="server">
           <h1>This is where the current returns will go</h1>

    And my codebehind is:

    protected void Page_PreRender(object sender, EventArgs e)
      if (!IsPostBack)
        foreach (TrustTaxReturnGroup ttrg in Ctl.FormerTTRGs)
          RadTab tab1 = new RadTab(ttrg.StartDate.ToString());
          tab1.Value = ttrg.StartDate.ToString();
          RadPageView pg1 = new RadPageView();
          pg1.ID = ttrg.StartDate.ToString();


    protected void rmpReturns_PageViewCreated(object sender, RadMultiPageEventArgs e)
      RadTextBox tb = new RadTextBox();
      tb.Text = "This should be on the page just created";
      tb.ID = e.PageView.ID + "_textbox";

    If I modify the markup to include


    the PageViewCreated method fires three times every time I click a tab (since there are three tabs being created programatically).  But if I don't have that in my markup it never enters that routine at all.  I thought maybe it had something to do with the pageviews being created in the PreRender but I moved it to the Page_OnLoad and the results are the same. 

    I'm sure it's something I'm just not seeing, but I'm just not seeing it.  Can anyone out there set me straight?  I'd greatly appreciate it.

  2. Denise
    Denise avatar
    5 posts
    Member since:
    Nov 2011

    Posted 09 Nov 2012 Link to this post

    Found the problem..... the code was in the page PreRender.  Once I moved it to PageLoad it worked.  I'd forgotten the lifecycle and that I could act upon previously created objects in the PreRender (thus the tabs got added) but not create new objects in there (thus the textboxes weren't getting placed in the pageview).
  3. Nencho
    Nencho avatar
    1646 posts

    Posted 12 Nov 2012 Link to this post

    Hello Denise,

    I am glad to see, that the problem you were facing is now resolved.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top