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

Trying to create an example server side

2 Answers 68 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Lighthouse Developer
Top achievements
Rank 1
Lighthouse Developer asked on 14 May 2010, 02:09 PM
Well, here's my code on the ascx file

        <asp:UpdatePanel ID="UpdatePanel" runat="server"
                <ContentTemplate> 
                    <telerik:RadEditor ID="RadEditor" CssClass="RadEditor" runat="server" Width="98%"
                    </telerik:RadEditor> 
                    <div class="radiobuttonlist"
                        <b>Choose a toolbar style:</b> 
                        <asp:RadioButtonList RepeatDirection="Vertical" Width="130px" CellPadding="0" CellSpacing="0" 
                            OnSelectedIndexChanged="RadioButtonListEditModeSelectedIndexChanged" CssClass="text" 
                            ID="RadioButtonListEditMode" runat="server" AutoPostBack="True"
                            <asp:ListItem Value="FullSet">Advanced toolset</asp:ListItem> 
                            <asp:ListItem Value="Default">Default</asp:ListItem> 
                            <asp:ListItem Value="BasicTools">Basic toolset</asp:ListItem> 
                        </asp:RadioButtonList> 
                    </div> 
                </ContentTemplate> 
            </asp:UpdatePanel> 

I'm trying to do the same on the code behind. I create a tabstrip programmatically and I want in each pageview to have an update control that does the same as the above. The above is part of the Overview example of RadEditor. My code behind is this : 

        protected void Tabstrip1TabDataBound(object sender, RadTabStripEventArgs e) 
        { 
            RadPageView newpage = new RadPageView(); 
             
            RadEditor editor = new RadEditor {ID = "radeditor" + e.Tab.Index}; 
 
            UpdatePanel updatepanel = new UpdatePanel {ID = "updatepanel" + e.Tab.Index}; 
            updatepanel.UpdateMode = UpdatePanelUpdateMode.Conditional; 
 
            //RadioButtonList Start 
            RadioButtonList rbl = new RadioButtonList(); 
            rbl.RepeatDirection = RepeatDirection.Vertical; 
            rbl.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.Tab.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>"}; 
 
            updatepanel.ContentTemplateContainer.Controls.Add(editor); 
            updatepanel.ContentTemplateContainer.Controls.Add(ltr); 
            updatepanel.ContentTemplateContainer.Controls.Add(rbl); 
            updatepanel.ContentTemplateContainer.Controls.Add(ltr2); 
 
            newpage.Controls.Add(updatepanel); 
            multipage1.PageViews.Add(newpage); 
        } 
 

I'm really stuck and that's why I'm turning here. Any help or visible errors? My problem is that when I create it programmatically, it's like the UpdatePanel doesn't work. The RadioButtonList just posts back on the page...

2 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 20 May 2010, 10:13 AM
Hello,

These controls inside the pageviews should be added on every postback and the best place for this is in PageViewCreated event handler. I've attached a simple page based on your code to demonstrate this approach, please download it and examine it.

All the best,
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.
0
Lighthouse Developer
Top achievements
Rank 1
answered on 20 May 2010, 12:05 PM
Thanks a lot! With a few adjustments, this works fine in my example!
Tags
TabStrip
Asked by
Lighthouse Developer
Top achievements
Rank 1
Answers by
Yana
Telerik team
Lighthouse Developer
Top achievements
Rank 1
Share this question
or