Hi, I am attempting to use a Tabstrip / Multipage inside a custom control. I have created a simple control to illustrate the problem I am having.
This gives me a JavaScript error: 'undefined is null or not an object', and the tabstrip will not change multipage.
Could someone advise where I am going wrong please?
using System; |
using System.Collections.Generic; |
using System.Text; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using Telerik.Web.UI; |
namespace BT.NIEA.StakeholderControls |
{ |
[ToolboxData("<{0}:TestTabStrip runat=server></{0}:TestTabStrip>")] |
public class TestTabStrip : WebControl |
{ |
protected override void OnInit(EventArgs e) |
{ |
// Create a Panel |
Panel pnlCreate = new Panel(); |
pnlCreate.Visible = true; |
// Create a Tabs Strip |
RadTabStrip ts = new RadTabStrip(); |
RadTab tab1 = new RadTab(); |
tab1.Text = "Basic Information"; |
tab1.Selected = true; |
RadTab tab2 = new RadTab(); |
tab2.Text = "Address Details"; |
RadTab tab3 = new RadTab(); |
tab3.Text = "Optional Information"; |
ts.Tabs.Add(tab1); |
ts.Tabs.Add(tab2); |
ts.Tabs.Add(tab3); |
// Create a Multipage |
RadMultiPage rmpCreate = new RadMultiPage(); |
// Set the multipage ID of the tab strip |
ts.MultiPageID = "rmpCreate"; |
rmpCreate.SelectedIndex = 0; |
// Create a Page View |
RadPageView pvPage1 = new RadPageView(); |
// Create a Button and add it to the PageView |
Button myButton1 = new Button(); |
myButton1.Text = "Button 1"; |
pvPage1.Controls.Add(myButton1); |
// Create a Page View |
RadPageView pvPage2 = new RadPageView(); |
// Create a Button and add it to the PageView |
Button myButton2 = new Button(); |
myButton2.Text = "Button 2"; |
pvPage2.Controls.Add(myButton2); |
// Create a Page View |
RadPageView pvPage3 = new RadPageView(); |
// Create a Button and add it to the PageView |
Button myButton3 = new Button(); |
myButton3.Text = "Button 3"; |
pvPage3.Controls.Add(myButton3); |
// Add the PageViews to Our Multi Page |
rmpCreate.PageViews.Add(pvPage1); |
rmpCreate.PageViews.Add(pvPage2); |
rmpCreate.PageViews.Add(pvPage3); |
// Add The TabStrip to Our Panel |
pnlCreate.Controls.Add(ts); |
// Add the MultiPage to the Panel |
pnlCreate.Controls.Add(rmpCreate); |
// Finally add the Panel to the Page |
this.Controls.Add(pnlCreate); |
} |
protected override void Render(HtmlTextWriter writer) |
{ |
base.Render(writer); |
} |
} |
} |
This gives me a JavaScript error: 'undefined is null or not an object', and the tabstrip will not change multipage.
Could someone advise where I am going wrong please?