Ajax not working on dynamic radstriptab

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    4 posts
    Member since:
    Jun 2016

    Posted 14 Jun Link to this post

    <script type="text/javascript">
                /* Viewstate <![CDATA[ */
                function onTabSelecting(sender, args) {
      
                    if (args.get_tab().get_pageViewID()) {
                        args.get_tab().set_postBack(false);
                    }
                }
     
                /* ]]> */
    </script>
     
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"
            Transparency="1">
        </telerik:RadAjaxLoadingPanel>
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1"  />
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
    </telerik:RadAjaxManager>
     
    <telerik:RadSplitter RenderMode="Lightweight" ID="RadSplitter1" runat="server" Height="600" Width="100%">
                       <telerik:RadPane ID="navigationPane" runat="server" Width="250" Scrolling="Y"  >
                       <telerik:RadPanelBar RenderMode="Lightweight" id="RadPanelBar1" runat="server" OnItemClick="RadPanelBar1_ItemClick" >
                        <Items>
                            <telerik:RadPanelItem ID="whs" runat="server" Text="Warehouse" ImageUrl="~/images/right.png">
                  
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem runat="server" Text="Customer" ImageUrl="~/images/right.png" >
                                <Items>
                                    <telerik:RadPanelItem runat="server" Text="Customer" Value="1">
                                    </telerik:RadPanelItem>
                                    <telerik:RadPanelItem runat="server" Text="Transaction" Value="2">
                                    </telerik:RadPanelItem>
           
                                </Items>
                        </telerik:RadPanelBar>
                     </telerik:RadPane>
     
                 <telerik:RadSplitBar ID="RadSplitbar1" runat="server" CollapseMode="Forward"  EnableResize="false">
                 </telerik:RadSplitBar>
                 <telerik:RadPane ID="contentPane" runat="server" Scrolling="Both" Width="100%">
                            <telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip1"  Orientation="HorizontalTop" Width="100%"  AutoPostBack="True"
                            MultiPageID="RadMultiPage1" Skin="Default"  OnTabClick="RadTabStrip1_TabClick" SelectedIndex="0"  OnClientTabSelecting="onTabSelecting" >
                            <Tabs></Tabs>
                            </telerik:RadTabStrip>
                <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0"
                                 Height="100%" Width="100%"  OnPageViewCreated="RadMultiPage1_PageViewCreated" EnableEmbeddedScripts="true">
                            </telerik:RadMultiPage>
    </telerik:RadPane>
    </telerik:RadSplitter>

     

    protected void RadPanelBar1_ItemClick(object sender, RadPanelBarEventArgs e)
        {
            var itemLevel = e.Item.Level;
            var itemValue = e.Item.Value;
            bool existTab = false;
            RadPageView myPageView = null;
            if (itemLevel > 0)
            {
                foreach(RadTab rt in RadTabStrip1.Tabs)
                {
                    if (itemValue == rt.Value) existTab = true;
                }
            if (!existTab) {
                        RadTab myTab = AddTab(e.Item.Text + "(" + (RadTabStrip1.Tabs.Count) + ")", itemValue);
             if (itemValue == "1")
                            myPageView = AddPageView("Customer","Customer.aspx");
                        else if (itemValue == "2")
                            myPageView = AddPageView("Transaction","Transaction.aspx");
                myTab.PageViewID = myPageView.ID;
                        myTab.Selected = true;
                        myPageView.Selected = true;
                   }
        }
     
     
         protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
            {
                e.Tab.PageView.Selected = true;
     
            }
     
         protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
            {
             if (e.PageView.ID.Contains("Customer"))
                e.PageView.ContentUrl = "Customer.aspx";
                   else if (e.PageView.ID.Contains("Transaction"))
                        e.PageView.ContentUrl = "Transaction.aspx";
             else
                 e.PageView.ContentUrl = "MainPage.aspx";
        }

    I'm creating  a tab and a pageview when i click on item in radpanel . I'd implement the ajax to prevent the postback but its not working. Every setting or filter in previous pageview will be reset.

    Regards,

    Patrick

  2. Patrick
    Patrick avatar
    4 posts
    Member since:
    Jun 2016

    Posted 14 Jun in reply to Patrick Link to this post

    I think the problem is simply because of ajax not working with Iframe. I'll looking for alternate solutions.

    Thanks.

Back to Top