PageViewCreated fires on its own

2 posts, 0 answers
  1. Lighthouse Developer
    Lighthouse Developer avatar
    34 posts
    Member since:
    Feb 2010

    Posted 25 May 2010 Link to this post

    Well, maybe not on its own. My problem is that it fires before even Page_Load. I have the following code to create each page view programmatically :

            protected void Multipage1PageViewCreated(object sender, RadMultiPageEventArgs e) 
            { 
                RadPageView newpage = e.PageView; 
     
                RadEditor editor = new RadEditor { ID = "radeditor" + e.PageView.Index, Width = 800}; 
     
                UpdatePanel updatepanel = new UpdatePanel 
                                              { 
                                                  ID = "updatepanel" + e.PageView.Index, 
                                                  UpdateMode = UpdatePanelUpdateMode.Conditional 
                                              }; 
     
                //RadioButtonList Start  
                RadioButtonList rbl = new RadioButtonList {RepeatDirection = RepeatDirection.Vertical, Width = 130}; 
                rbl.SelectedIndexChanged += new EventHandler(RadioButtonListEditModeSelectedIndexChanged); 
                rbl.AutoPostBack = true
     
     
                ListItem li1 = new ListItem(); 
                ListItem li2 = new ListItem(); 
                ListItem li3 = new ListItem(); 
                rbl.ID = "radiobuttonlist" + e.PageView.Index; 
                li1.Value = "FullSet"
                li1.Text = "Advanced toolset"
                li2.Value = "Default"
                li2.Text = "Default"
                li3.Value = "BasicTools"
                li3.Text = "Basic toolset"
                rbl.Items.Add(li1); 
                rbl.Items.Add(li2); 
                rbl.Items.Add(li3); 
                //RadioButtonList End  
     
                Literal ltr = new Literal 
                { 
                    Text = "<div class=\"radiobuttonlist\"><b>Choose a toolbar style:</b>" 
                }; 
                Literal ltr2 = new Literal { Text = "</div>" }; 
                Literal ltrTitle = new Literal {Text = "<h2>Τίτλος</h2>"}; 
                TextBox txtTitle = new TextBox(); 
                txtTitle.Width = 800; 
                txtTitle.Height = 20; 
                Literal ltrDivStart = new Literal {Text = "<div class='ArticleTitle'>"}; 
                Literal ltrDivEnd = new Literal {Text = "</div>"}; 
                Literal ltrDivStart2 = new Literal { Text = "<div style='float:left;'>" }; 
                Literal ltrDivEnd2 = new Literal { Text = "</div>" }; 
                updatepanel.ContentTemplateContainer.Controls.Add(editor); 
                updatepanel.ContentTemplateContainer.Controls.Add(ltr); 
                updatepanel.ContentTemplateContainer.Controls.Add(rbl); 
                updatepanel.ContentTemplateContainer.Controls.Add(ltr2); 
     
                newpage.Controls.Add(ltrDivStart); 
                newpage.Controls.Add(ltrTitle); 
                newpage.Controls.Add(txtTitle); 
                newpage.Controls.Add(ltrDivEnd); 
                newpage.Controls.Add(ltrDivStart2); 
                newpage.Controls.Add(updatepanel); 
                newpage.Controls.Add(ltrDivEnd2); 
                HiddenField hiddenField = new HiddenField(); 
                hiddenField.Value = Languages[e.PageView.Index]; 
                newpage.Controls.Add(hiddenField); 
            } 
     

    This was suggested by a member of the team. Now, outside of the control that contains the tab strip and multi page and all that I have an asp:Button. On its OnClick event I want to get the values of everything in this control. My problem is that PageViewCreated fires before everything else when I click the button. Before the function I have for OnClick and before Page_Load. Any solutions? Thanks in advance.
  2. Yana
    Admin
    Yana avatar
    5044 posts

    Posted 26 May 2010 Link to this post

    Hi,

    Actually this is expected behavior, PageViewCreated event is fired before Page_Load, because the controls should be added exactly at this moment to the Controls collection of the pageview. What exactly is the problem with this, please explain in more details?

    Kind regards,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top