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

cannot do load on demand RadTabStrip that loads user control

1 Answer 99 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
EJ
Top achievements
Rank 1
EJ asked on 22 Jun 2010, 09:12 PM
i keep getting this error

Microsoft JScript runtime error: 'get_postBackElement().id' is null or not an object

when I click on the second or third tab

when I try to implement the load on demand radtabstrip demo

i am using 2010.1 519 version of the controls

the demo seems to say this should work - is this a bug?

aspx page
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadTabStrip1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadMultiPage1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <script type="text/javascript"
        function onTabSelecting(sender, args) { 
            var foo = args.get_tab(); 
            if (args.get_tab().get_pageViewID()) { 
                args.get_tab().set_postBack(false); 
            } 
        } 
    </script> 
                    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0" 
                        MultiPageID="RadMultiPage1" Orientation="HorizontalTop" 
                        OnTabClick="RadTabStrip1_TabClick" OnClientTabSelecting="onTabSelecting"
                    </telerik:RadTabStrip> 
                    <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" 
                        Height="250px" Width="475px" BorderWidth="1" OnPageViewCreated="RadMultiPage1_PageViewCreated"
                    </telerik:RadMultiPage> 


code behind
 protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!Page.IsPostBack) 
        { 
            AddTab(RadTabStrip1, "Tab1"); 
            AddPageView(RadMultiPage1, RadTabStrip1.FindTabByText("Tab1")); 
            AddTab(RadTabStrip1, "Tab2"); 
            //AddPageView(RadMultiPage1, RadTabStrip1.FindTabByText("Tab2")); 
            AddTab(RadTabStrip1, "Tab3"); 
            //AddPageView(RadMultiPage1, RadTabStrip1.FindTabByText("Tab3")); 
        } 
    } 
 
    private void AddTab(RadTabStrip tabstrip, string tabName) 
    { 
        RadTab tab = new RadTab(); 
        tab.Text = tabName
        tabstrip.Tabs.Add(tab); 
    } 
 
    private void AddPageView(RadMultiPage multipage, RadTab tab) 
    { 
        RadPageView pageView = new RadPageView(); 
        pageView.ID = tab.Text; 
        multipage.PageViews.Add(pageView); 
        tab.PageViewID = pageView.ID; 
    } 
 
    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e) 
    { 
        AddPageView(RadMultiPage1, e.Tab); 
        e.Tab.PageView.Selected = true
    } 
 
    protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e) 
    { 
        string userControlPath = "~/WebUserControl.ascx"
 
        Control userControl = Page.LoadControl(userControlPath); 
        if (e.PageView.ID == "Tab1") 
        { 
            userControl.ID = "UserControl1"
        } 
        else if (e.PageView.ID == "Tab2") 
        { 
            userControl.ID = "UserControl2"
        } 
        else if (e.PageView.ID == "Tab3") 
        { 
            userControl.ID = "UserControl3"
        } 
 
        e.PageView.Controls.Add(userControl); 
    } 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 25 Jun 2010, 12:26 PM
Hi EJ,

I've just answered to the support ticket regarding this issue. Here is my reply:

I've tested the provided project but wasn't able to reproduce the described issue. Could you please send us the exact steps? Does the error occur every time you click a tab?

Best 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
Tags
TabStrip
Asked by
EJ
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or