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

Dynamic Creation of TabStrip

1 Answer 124 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 23 Jan 2009, 01:01 PM
Hi! Today I downloaded the toolkit, now i want to create a tabstrip only using c# code.

i tried following:

protected void Page_Load(object sender, EventArgs e)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RadTabStrip strip = new RadTabStrip();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RadTab tab1 = new RadTab();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tab1.Text = "Tab2";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RadTab tab2 = new RadTab();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tab1.Text = "Tab1";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strip.Tabs.Add(tab1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strip.Tabs.Add(tab2);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RadPageView view = new RadPageView();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; view.ID = "Customer Data";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RadMultiPage mpage = new RadMultiPage();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mpage.ID = "MPage1";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mpage.PageViewCreated += MultiPage_PageViewCreated;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mpage.PageViews.Add(view);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strip.MultiPageID = "MPage1";<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DynHolder.Controls.Add(mpage);<br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void MultiPage_PageViewCreated(object sender, RadMultiPageEventArgs e)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RadComboBox box = new RadComboBox();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.PageView.Controls.Add(box);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 

But nothing is shown on the page, can somebody help me. I would like to dynamically create a tabstrip in an asp placeholder. I don't want any code written in asp for this control.

regards
!nst!nct

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Jan 2009, 01:32 PM
Hi Martin,

You have added the MultiPage control to the placeholder rather than adding the TabStrip control in your code. Check out the following code :
cs:
 protected void Page_Load(object sender, EventArgs e) 
    {        
            RadTabStrip strip = new RadTabStrip(); 
            RadTab tab1 = new RadTab(); 
            tab1.Text = "Tab2"
            RadTab tab2 = new RadTab(); 
            tab2.Text = "Tab1"
            strip.Tabs.Add(tab1); 
            strip.Tabs.Add(tab2); 
            RadPageView view = new RadPageView(); 
            view.ID = "Customer Data"
            RadMultiPage mpage = new RadMultiPage(); 
 
            mpage.ID = "MPage1"
            mpage.PageViewCreated += new RadMultiPageEventHandler(mpage_PageViewCreated); 
            mpage.PageViews.Add(view); 
            strip.MultiPageID = "MPage1"
            PlaceHolder1.Controls.Add(strip); 
    } 

Thanks
Princy.
Tags
TabStrip
Asked by
Roland
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or