Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

.Net Guru's

Options
  • 10-12-2008 7:06pm
    #1
    Registered Users Posts: 2,791 ✭✭✭


    I've been trying to work out this problem for a few days but I'm stuck, and none of my co-workers have any idea :(

    I have a Master page containing an UpdateProgress control.

    I have a content page based on this masterpage with it's own custom UpdateProgress control which provides feedback on an asynchronous transaction.

    The two update progress controls conflict with each other in the UI so I'd like to disable the one in the Masterpage while the custom progress control is running.

    I have "disabled" it by setting its visible property to false and this works fine (there is no conflict in the UI). When the asynchronous execution is finished I set the visible property back to true.

    The visibility properties are both set before the PreRender event so there shouldnt really be any problem. However, the general UpdateProgress control in the Masterpage does not display after running a task that uses the asynchronous task.

    I'm at my wits end here, anyone have any possible solutions? I don't even know what to search for with google :confused:


Comments

  • Registered Users Posts: 610 ✭✭✭nialo


    ah. two questions..
    do you get an error message? or if your debugging a break point?

    and is your masterpage update progress bar inside or outside your update panel? im assuming your using an update panel cause they go hand in hand most of the time. could be something as simple as your master page never actually refreshes as it is an async postback. and it wouldnt refresh if the update progress is outside the update panel....

    also a snippet of where your declaring your updateProgress control on both pages mite help.. ive just tried putting both on a page im using at the moment with no issues. :(


  • Registered Users Posts: 2,791 ✭✭✭John_Mc


    nialo wrote: »
    ah. two questions..
    do you get an error message? or if your debugging a break point?

    and is your masterpage update progress bar inside or outside your update panel? im assuming your using an update panel cause they go hand in hand most of the time. could be something as simple as your master page never actually refreshes as it is an async postback. and it wouldnt refresh if the update progress is outside the update panel....

    also a snippet of where your declaring your updateProgress control on both pages mite help.. ive just tried putting both on a page im using at the moment with no issues. :(

    Hi, thanks for your reply!

    There are no errors and I've set breakpoints where the visible property is set to true/false. They are correctly visited when the conditions are right.

    I've also set a breakpoint in the PreRender event and ensured that the visible property is what it's meant to be.

    I'm at home now so can't consult the code or paste any snippets but I believe you could be right about the refreshing. How could I resolve this?


  • Registered Users Posts: 610 ✭✭✭nialo


    Possibly two ways. you could change the post back to be PostBackTrigger on the content page and force a reload. Gives you greater control but you got to code more. Way of testing would be to do a redirect to the same content page after the postback! this will reload the master and content pages fully.

    Or you could look at your update panel on your master page. it mite be set to UpdateMode="conditional" and ChildrenAsTriggers="false". change both of these to UpdateMode="Always" and ChildrenAsTriggers="true", will unsure that for all async postbacks it will reload the page and this should update the progress control.


  • Registered Users Posts: 2,791 ✭✭✭John_Mc


    nialo wrote: »
    Possibly two ways. you could change the post back to be PostBackTrigger on the content page and force a reload. Gives you greater control but you got to code more. Way of testing would be to do a redirect to the same content page after the postback! this will reload the master and content pages fully.

    Or you could look at your update panel on your master page. it mite be set to UpdateMode="conditional" and ChildrenAsTriggers="false". change both of these to UpdateMode="Always" and ChildrenAsTriggers="true", will unsure that for all async postbacks it will reload the page and this should update the progress control.

    Nice one, will try this tomorrow at work. Thanks a million for the help :)


  • Registered Users Posts: 610 ✭✭✭nialo


    did you get anywhere?


  • Advertisement
  • Registered Users Posts: 2,791 ✭✭✭John_Mc


    nialo wrote: »
    did you get anywhere?
    Possibly two ways. you could change the post back to be PostBackTrigger on the content page and force a reload. Gives you greater control but you got to code more. Way of testing would be to do a redirect to the same content page after the postback! this will reload the master and content pages fully.

    This isnt an option for me as there isnt a control to set as the postback trigger. I need an non-control based method of getting a full postback if that's possible?
    Or you could look at your update panel on your master page. it mite be set to UpdateMode="conditional" and ChildrenAsTriggers="false". change both of these to UpdateMode="Always" and ChildrenAsTriggers="true", will unsure that for all async postbacks it will reload the page and this should update the progress control.

    This didn't make any difference. When the custom progress update code has finished and set the appropriate visibility properties, the page does not refresh itself.

    Is there a way to refresh a page without losing viewstate or postback data?


  • Registered Users Posts: 1,266 ✭✭✭Overflow


    Can you post some code of the Masterpage and the content page that uses this Masterpage, it will give me a better idea of the scenario.


  • Registered Users Posts: 2,791 ✭✭✭John_Mc


    Overflow wrote: »
    Can you post some code of the Masterpage and the content page that uses this Masterpage, it will give me a better idea of the scenario.

    Sure, and thanks for your reply.

    The Masterpage:
    <asp:UpdateProgress ID="uprog" AssociatedUpdatePanelID="upGridResult" runat="server" DynamicLayout="true" DisplayAfter="0" >
             <ProgressTemplate>
                <div id="DivUpdateProgress" class="UpdateProgressContainer">
                  <div class="UpdateProgressContainerContent">
                    <img id="img1" src="../App_Themes/<%=Page.Theme%>/Images/Progress.gif" alt="Loading"/>
                    Please wait...
                  </div>
                </div>
             </ProgressTemplate>
           </asp:UpdateProgress> 
    
    <asp:UpdatePanel runat="server" ID="upGridResult" RenderMode="inline">
            <ContentTemplate>      
              <asp:Panel runat="server" ID="panResult" CssClass="ReportContents">
                <div class="BreadcrumbContainer">
                  <asp:Panel ID="panBreadCrumb" runat="server"/>
                </div>                             
                <br />
                <asp:Panel ID="panGridResult" runat="server">
    
    .... etc etc Too much markup to post here
    

    The content page:
    <asp:Content ContentPlaceHolderID="cphReportRunning" runat="server">  
      <asp:PlaceHolder runat="server" ID="phReportStatus" Visible="false">
        <rs:ReportStatus ID="rsReportStatus" runat="server" IntervalMilSec="3000" />
          <div class="UpdateProgressContainerContent">
            <img id="img1" src="../App_Themes/<%=Page.Theme%>/Images/Progress.gif" alt="Loading"/>
            Please wait...
            <br />
            <asp:Label runat="server" ID="lbStatus" Visible="false" />
            <br />
            <asp:LinkButton ID="btnCancelReport" Text="<%$Resources:Resource, lang_sCancel %>"   OnClientClick="StopPoll();if(this.disabled) return false;this.disabled=true;" runat="server" />
         </div>
      </asp:PlaceHolder>
    
    

    The Method for setting progressUpdate visibility properties and the like:
     private void HandleReportStatus(Schedule.RequestStatus status)
        {
          if (status == Schedule.RequestStatus.QUEUED || status == Schedule.RequestStatus.RUNNING)
          {
            Master.ResultPanel.Visible = false;
            Master.GridDirty = false;
           
            Master.MasterUpdateProgressControl.Visible = false;
            phReportStatus.Visible = true;
    
            // set display text
            lbStatus.Text = Resources.Resource.lang_sRepStatusRunning;
    
            rsReportStatus.Value = ((int)status).ToString();
            rsReportStatus.StartPoll();
            // set header to readonly if not readonly
            oHeader.ReadOnly = true;
          }
          else
          {
            phReportStatus.Visible = false;        
            Master.ResultPanel.Visible = true;
            Master.MasterUpdateProgressControl.Visible = true;
            Master.GridDirty = true;
            oHeader.ReadOnly = false;
          }
        }
    


Advertisement