RadTabstrip with master page throws javascript exception with dynamic multipageviews

2 posts, 0 answers
  1. Mac P
    Mac P avatar
    86 posts
    Member since:
    Mar 2010

    Posted 17 Mar 2010 Link to this post

    When i use telerik's sample of creating dynamic page views and adding usercontrols it throws an exception.

    To recreate

    1) Make telerik ajax project in vs2010
    2) Add a master page and add radajaxmanager,radscriptmanager and radajaxloadingpanel
    3) Add content page with the following

    <

     

     

    asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

     

     

     

     

    <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">

     

     

     

    <AjaxSettings>

     

     

     

    <telerik:AjaxSetting AjaxControlID="Panel1">

     

     

     

    <UpdatedControls>

     

     

     

    <telerik:AjaxUpdatedControl ControlID="Panel1" />

     

     

     

    </UpdatedControls>

     

     

     

    </telerik:AjaxSetting>

     

     

     

    <telerik:AjaxSetting AjaxControlID="TabStrip">

     

     

     

    <UpdatedControls>

     

     

     

    <telerik:AjaxUpdatedControl ControlID="TabStrip" />

     

     

     

    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1"

     

     

     

    LoadingPanelID="RadAjaxLoadingPanel1" />

     

     

     

    </UpdatedControls>

     

     

     

    </telerik:AjaxSetting>

     

     

     

    <telerik:AjaxSetting AjaxControlID="RadMultiPage1">

     

     

     

    <UpdatedControls>

     

     

     

    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />

     

     

     

    </UpdatedControls>

     

     

     

    </telerik:AjaxSetting>

     

     

     

    </AjaxSettings>

     

     

     

    </telerik:RadAjaxManagerProxy>

     

     

     

    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Sunset">

     

     

     

    </telerik:RadSkinManager>

     

     

     

     

    <telerik:RadTabStrip ID="TabStrip" runat="server" ViewStateMode="Enabled" OnClientTabSelecting="onTabSelecting"

     

     

     

    ClientIDMode="Static" MultiPageID="RadMultiPage1" OnTabClick="RadTabStrip1_TabClick"

     

     

     

    SelectedIndex="0">

     

     

     

    </telerik:RadTabStrip>

     

     

     

    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage"

     

     

     

    ClientIDMode="Static" ViewStateMode="Enabled" OnPageViewCreated="RadMultiPage1_PageViewCreated">

     

     

     

    </telerik:RadMultiPage>

     

     

     

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

     

     

     

    <script type="text/javascript">

     

     

     

    function onTabSelecting(sender, args) {

     

     

     

    if (args.get_tab().get_pageViewID()) {

     

    args.get_tab().set_postBack(

     

    false);

     

    }

    }

     

     

     

    </script>

     

     

     

    </telerik:RadCodeBlock>

     



    Add codebehined with following

    using

     

     

    System;

     

    using

     

     

    System.Collections.Generic;

     

    using

     

     

    System.Linq;

     

    using

     

     

    System.Web;

     

    using

     

     

    System.Web.UI;

     

    using

     

     

    System.Web.UI.WebControls;

     

    using

     

     

    Telerik.Web.UI;

     

    namespace

     

     

    TabStripMasterPageSample

     

    {

     

     

    public partial class Content : System.Web.UI.Page

     

    {

     

     

    protected void Page_Load(object sender, EventArgs e)

     

    {

     

     

    if (!IsPostBack)

     

    {

    AddTab(

     

    "Test");

     

    AddPageView(TabStrip.FindTabByText(

     

    "Test"));

     

    AddTab(

     

    "Test3");

     

    AddTab(

     

    "Test2");

     

    }

    }

     

     

    private void AddTab(string tabName)

     

    {

     

     

    var tab = new RadTab { Text = tabName };

     

    TabStrip.Tabs.Add(tab);

    }

     

     

    protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)

     

    {

     

     

    string userControlName = e.PageView.ID + ".ascx";

     

     

     

    var userControl = Page.LoadControl(userControlName);

     

    userControl.ID = e.PageView.ID +

     

    "_userControl";

     

    e.PageView.Controls.Add(userControl);

    }

     

     

    private void AddPageView(RadTab tab)

     

    {

     

     

    var pageView = new RadPageView { ID = tab.Text };

     

    RadMultiPage1.PageViews.Add(pageView);

    pageView.CssClass =

     

    "pageView";

     

    tab.PageViewID = pageView.ID;

    }

     

     

    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)

     

    {

    System.Threading.

     

    Thread.Sleep(10000);

     

    AddPageView(e.Tab);

    e.Tab.PageView.Selected =

     

    true;

     

    }

    }

    }

  2. Yana
    Admin
    Yana avatar
    5043 posts

    Posted 23 Mar 2010 Link to this post

    Hello Mac P,

    Thank you for providing the code - the problem is caused by ClientIDMode property of the tabstrip and multipage, please remove it in order to fix this issue.

    Greetings,
    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