RadMultiPage Load on demand

8 posts, 0 answers
  1. tri
    tri avatar
    10 posts
    Member since:
    Oct 2006

    Posted 07 Nov 2011 Link to this post

    I am using Telerik Controls 2011.1.315.35

    We have a load on demand RadMultiPage linked with a RadToolBar

    There are several pages and it successfully loads only the page I require when it first loads.

    The problem occurs when I click on the tool bar to open another page, the page loads correctly but at the same time it will load the original page again as well, losing any of the values that have been changed in that page.

    If I click back to the original page and change a value and then click back to the 2nd page I opened then all is well and the 1st page will not reload. 

    The tool bar click is controlled by a JavaScript function

     function onButtonClicked(sender, args)
     {
    var multipage=$find("MultpageView");
            var ajaxManager = $find('<%= RadAjaxManager1.ClientID %>');
            var pageView = multipage.findPageViewByID(args.get_item().get_value())
                    
            if(pageView ==null)
            {
                        ajaxManager.ajaxRequest(args.get_item().get_value());  
             }
             else
             {
                        pageView.set_selected(true);
                        ResizeFrame();
             }
    }

    This is working and the new page will only be added to the MultiPage if it hasn't already been added. What I need to do is prevent the Pages that have been added from reloading and losing any values that have been changed.

    Each page is contained in its own control that is added to the new page


    Ajax Call on Server side is as follows
     Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As AjaxRequestEventArgs) Handles  RadAjaxManager1.AjaxRequest
            AddPageView(e.Argument)
    End Sub

    Private Sub AddPageView(ByVal pageViewID As String)
            Dim pageView As New RadPageView()
            pageView.ID = pageViewID
            If MultpageView.FindPageViewByID(pageViewID) Is Nothing Then
                MultpageView.PageViews.Add(pageView)
            End If
    End Sub

    When the new Page View is created the control is added using the PageVIewCreated event

    Protected Sub MultpageView_PageViewCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMultiPageEventArgs) Handles MultpageView.PageViewCreated
            Dim UserControlName As String = e.PageView.ID + ".ascx"
            Dim userControl As Control = Page.LoadControl("PageControls/" & UserControlName)
            userControl.ID = e.PageView.ID + "_userControl"
            e.PageView.Controls.Add(userControl)
            MultpageView.FindPageViewByID(e.PageView.ID).Selected = True
    End Sub



  2. tri
    tri avatar
    10 posts
    Member since:
    Oct 2006

    Posted 08 Nov 2011 Link to this post

    Any solutions?
  3. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 10 Nov 2011 Link to this post

    Hello Tri,

    I've prepared a sample page based on the code snippets provided. Please try to follow the same approach in your scenario.

    All the best,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  4. tri
    tri avatar
    10 posts
    Member since:
    Oct 2006

    Posted 10 Nov 2011 Link to this post

    Thanks for your help I will have a look at what you have done
  5. tri
    tri avatar
    10 posts
    Member since:
    Oct 2006

    Posted 10 Nov 2011 Link to this post

    This is what I have already but the controls are ascx files
    Could it be this that is causing the issue

    The ascx controls basically have code similar to the following

    <table border="0" cellpadding="0 " cellspacing="0" style="width: 100%;border: 0" id="WorkflowAudit">
        <tr style="height: 27px; width: 100%" class="qsfexHeader">
            <td style="width:100%; background-color:#BFDBFF" class="VIEWBOXCAPTION14" >
                Workflow AuditLog
            </td>
        </tr>
        <tr style="height: 100%;">
            <td style="width: 100%; height: 100%" colspan="2" valign="top">
                <iframe id="fraWorkFlowAudit" src="../TaskView/WF_FSAuditLog.aspx?ProcId=<%= ProcessInstanceId %>"  width="100%" height="100%" frameborder="0" scrolling="no" ></iframe>
            </td>
        </tr>
    </table>

    Each page will reload every time I load a new page view
  6. tri
    tri avatar
    10 posts
    Member since:
    Oct 2006

    Posted 10 Nov 2011 Link to this post

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
                 'do something
                  AddItemsToMenu()
        End If
    End Sub

    In addition the Toolbar is dynamically created but we do a postback
  7. tri
    tri avatar
    10 posts
    Member since:
    Oct 2006

    Posted 10 Nov 2011 Link to this post

    Ok an update, i have taken your example created 3 controls ascx and in one of these controls placed an iframe that called a page.

    The controls that didn't have an iframe retained their values but the control that had iframe lost its values and was reloaded, do you know of a way around this.

    Thanks
  8. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 15 Nov 2011 Link to this post

    Hi Tri,

    The experienced behavior is expected one. The ContentUrl property of the RadPageView is usually used to reference external pages. Whenever such PageView is set to visible a get request is made to load the content. You can't retain the state of the controls to a page which you reference using get request.

    Regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top