Problem with Load on Demand radmulti page and RadAjaxPanel

2 posts, 0 answers
  1. Peeyush
    Peeyush avatar
    17 posts
    Member since:
    Feb 2012

    Posted 08 Jan 2013 Link to this post

    Hello,

    I am using the load on demand for creating RadTab and Pageview dynamically, the problem i am facing is that on first the page is loaded properly, and when i seleting the next tab the page causes postback and works fine too, but after that my page freezes(no postback occurs on selecting different tabs, it seems like everything freezes). I tried by removing the timer event too but did not succeed.
            <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1">
            </telerik:RadAjaxLoadingPanel>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadAjaxPanelTimed">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadAjaxPanelTimed" LoadingPanelID="LoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <asp:Timer runat="server" ID="UpdateTimer" Interval="40000" />
            <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanelTimed" OnAjaxSettingCreating="RadAjaxPanelTimed_AjaxSettingCreating" >
                <telerik:RadTabStrip ID="tabSocialNetwork" runat="server" OnClientTabSelecting="OnClientTabSelecting" SelectedIndex="0" MultiPageID="radMultiPage"
                   OnTabClick="OnRadTab_SocialAccountClick">
                </telerik:RadTabStrip>
                <telerik:RadMultiPage ID="radMultiPage" runat="server" RenderSelectedPageOnly="true" SelectedIndex="0" Width="100%"
                    Height="500px" OnPageViewCreated="RadMultiPage1_PageViewCreated">
                </telerik:RadMultiPage>
            </telerik:RadAjaxPanel>
     
     
     
    CodeBehind:
     
     
    #region Load Event
            protected void Page_Load(object sender, EventArgs e)
            {
     
                if (!IsPostBack)
                {
                    objSocialNetworkBF = new SocialNetworkBF();
                    DataTable dtSocialAccount = objSocialNetworkBF.GetSocialAccount(compId, userId);
                    ViewState["SocialAccount"] = dtSocialAccount;
                    txtMessage.Attributes.Add(PureAnalyzer_WebApp.Onkeydown, PureAnalyzer_WebApp.EnterKeyPrevent);
                    btnSendItNow.Attributes.Add(PureAnalyzer_WebApp.Onkeydown, PureAnalyzer_WebApp.EnterKeyPrevent);
                    if (dtSocialAccount != null && dtSocialAccount.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dtSocialAccount.Rows)
                        {
                            SocialAccId = dr["SocialAccId"].ToString();
                            SocialAccount = dr["SocialAccount"].ToString();
                            AddTab(dr["SocialAccountScreenName"].ToString() + PureAnalyzer_WebApp.OpenBracket + dr["SocialAccount"].ToString() + PureAnalyzer_WebApp.ClosedBracket);
                           
                        }
                       // UpdateTimer.Interval = 60000;
                    }
     
                }
            }
     
            #endregion
            #region Add radtab
            private void AddTab(string tabName)
            {
                 
                RadTab tab = new RadTab();
                tab.Text = tabName;
                //tab.PostBack = true;
                tab.Value = tabName + "(" + SocialAccId + ")";
                tabSocialNetwork.Tabs.Add(tab);
                tab.ToolTip = tabName;
     
                if (flag)
                {
                    AddPageView(tab);
                    flag = false;
                }
            }
            #endregion
     
            #region OnRadTab click event
            protected void OnRadTab_SocialAccountClick(object sender, RadTabStripEventArgs e)
            {
                AddPageView(e.Tab);
                e.Tab.PageView.Selected = true;
            }
            #endregion
     
            #region Method to add pageview
            private void AddPageView(RadTab tab)
            {
                RadPageView pageView = new RadPageView();
                Guid pageViewGuid;
                pageViewGuid = Guid.NewGuid();
                string[] strAccVal = tab.Value.Split('(');
                pageView.ID = strAccVal[1].Remove(strAccVal[1].IndexOf(')')) + "," + strAccVal[2].Remove(strAccVal[2].IndexOf(')')) + "," + pageViewGuid.ToString();
                radMultiPage.PageViews.Add(pageView);
                tab.PageViewID = pageView.ID;
            }
            #endregion
     
            #region Rad multipage view created
            int Iteration = 0;
            protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
            {
                string []strPageviewID = e.PageView.ID.Split(',');
     
                if (!IsPostBack)
                {
                    if (strPageviewID[0] == "Twitter")
                    {
                        string userControlName = "TwitterConnect.ascx";
                        Control userControl = Page.LoadControl(userControlName);
                        Guid userControlTwitterGuid = Guid.NewGuid();
                        userControl.ID = userControlTwitterGuid.ToString() + "," + strPageviewID[1];
                        e.PageView.Controls.Add(userControl);
                    }
                    else if (strPageviewID[0] == "FaceBook")
                    {
                        string userControlName = "FacebookConnect.ascx";
                        Control userControl = Page.LoadControl(userControlName);
                        Guid userControlFacebookGuid = Guid.NewGuid();
                        userControl.ID = userControlFacebookGuid.ToString() + "," + strPageviewID[1];
                        e.PageView.Controls.Add(userControl);
                    }
                }
                else
                {
                    if (strPageviewID[0] == "Twitter")
                   {
                       string userControlName = "TwitterConnect.ascx";
                       Control userControl = Page.LoadControl(userControlName);
                       Guid userControlTwitterGuid = Guid.NewGuid();
                       userControl.ID = userControlTwitterGuid + "," + strPageviewID[1];
                       e.PageView.Controls.Add(userControl);
                       Iteration++;
                   }
                    else if (strPageviewID[0] == "FaceBook")
                   {
                       string userControlName = "FacebookConnect.ascx";
                       Control userControl = Page.LoadControl(userControlName);
                       Guid userControlFacebookGuid = Guid.NewGuid();
                       userControl.ID = userControlFacebookGuid + "," + strPageviewID[1];
                       e.PageView.Controls.Add(userControl);
                       Iteration++;
                   }
                    
                }
                 
            }
            #endregion
     
            #region RadPanel Ajaxsetting created
            protected void RadAjaxPanelTimed_AjaxSettingCreating(object sender, AjaxSettingCreatingEventArgs e)
            {
                AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
                trigger.ControlID = UpdateTimer.ID;
                trigger.EventName = "Tick";
                e.UpdatePanel.UpdateMode = UpdatePanelUpdateMode.Always;
                e.UpdatePanel.Triggers.Add(trigger);
            }
            #endregion
  2. Peeyush
    Peeyush avatar
    17 posts
    Member since:
    Feb 2012

    Posted 08 Jan 2013 Link to this post

    I tried with asp update panel too, but thought of using radajaxpanel instead.

    <asp:Timer runat="server" id="UpdateTimer" Interval="300000" />
            <asp:UpdatePanel runat="server" id="TimedPanel" updatemode="Always">
                <Triggers>
                    <asp:AsyncPostBackTrigger controlid="UpdateTimer"
                      eventname="Tick" />
                </Triggers>
                <ContentTemplate>
                <telerik:RadTabStrip ID="tabSocialNetwork" runat="server" OnClientTabSelecting="OnClientTabSelecting" SelectedIndex="0" MultiPageID="radMultiPage"
                   OnTabClick="OnRadTab_SocialAccountClick">
                </telerik:RadTabStrip>
                <telerik:RadMultiPage ID="radMultiPage" runat="server" RenderSelectedPageOnly="true" SelectedIndex="0" Width="100%"
                    Height="500px" OnPageViewCreated="RadMultiPage1_PageViewCreated">
                </telerik:RadMultiPage>
             </ContentTemplate>
            </asp:UpdatePanel>


    Urgent help will be highly appreciated!

    Thanks in advance!

    regards,
    Peeyush Pandey
Back to Top