Results 1 to 9 of 9

Thread: [RESOLVED] UpdateProgress not working under Updatepanel control.?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Resolved [RESOLVED] UpdateProgress not working under Updatepanel control.?

    Dear All,

    In my aspx page I have UploadFile, Button and a Gridview. I have embedded all controls in Updatepanel control but upon selecting file in UploadFile control, Upon click of the button UpdateProgress text message does not work whereas without using Updatepanel it works very fine.

    What could be the reason? and solution for this.

    see the code below:

    Code:
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" >
                            <ContentTemplate>
                                <table border="0" cellpadding="0" cellspacing="0" style="width: 100&#37;;">
                                    <tr>
                                        <td>
                                            <asp:Panel ID="Panel2" runat="server" GroupingText="Production Scheduling(Excel File)"
                                                Width="100%" Font-Bold="True" Font-Size="Larger" BorderColor="navy">
                                                <table id="Table1">
                                                    
                                                    <tr>
                                                        <td style="height: 1px; color: Red; width: 8px;">
                                                            *</td>
                                                        <td align="left" class="pl12 pb06 pr04" style="width: 139px; height: 4px" valign="middle">
                                                            <asp:Label ID="Label2" runat="server" Text="Select  file(.xls file)" Width="154px"></asp:Label></td>
                                                        <td align="left" class="pb06 pr04" style="width: 552px; height: 4px" valign="middle">
                                                            <asp:FileUpload ID="FileUpload2" runat="server" Width="300px" />
                                                            <asp:TextBox ID="txtXLSFile" runat="server" ReadOnly="True" Visible="False"></asp:TextBox><asp:Label
                                                                ID="lblXLSCount" runat="server" Width="75px"></asp:Label></td>
                                                    </tr>
                                                    <tr>
                                                        <td style="height: 1px; color: Red; width: 8px;">
                                                            *</td>
                                                        <td style="width: 139px;" class="pl12 pb06 pr04">
                                                            <asp:Label ID="Label1" runat="server" Text="CNC Machine Location" Width="130px"></asp:Label></td>
                                                        <td align="left" class="pb06 pr04" style="width: 552px;" valign="middle">
                                                            <asp:DropDownList ID="ddLocation" runat="server">
                                                            </asp:DropDownList>
                                                            <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                                                                <ProgressTemplate>
                                                                    <asp:Label ID="lblasymessage" runat="server" Text="Uploading bom & excel data..."
                                                                        Font-Names="Times New Roman" ForeColor="ActiveCaption"></asp:Label><img src="../Images/spinner.gif"
                                                                            alt="" />
                                                                </ProgressTemplate>
                                                            </asp:UpdateProgress>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="width: 8px">
                                                        </td>
                                                        <td style="width: 139px">
                                                            <asp:Label ID="lblMsg" runat="server" Font-Bold="True" ForeColor="Maroon"></asp:Label></td>
                                                        <td align="left" style="width: 552px">
                                                            <asp:Button CssClass="btnBorder" ID="btnAdd" OnClick="btnAdd_Click" runat="server"
                                                                Text="Upload BOM & Excel Data" Width="186px" Height="25px" />&nbsp;&nbsp;&nbsp;
                                                        </td>
                                                    </tr>
                                                </table>
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table>
                                                <asp:GridView ID="grdMaster" Visible="true" runat="server" Width="100%" >
                                                </asp:GridView>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                            <Triggers>
                                <asp:PostBackTrigger ControlID="btnAdd" />
                                <asp:PostBackTrigger ControlID="grdMaster" />
                            </Triggers>
                        </asp:UpdatePanel>
    Regards,
    PPCC
    Last edited by mendhak; Apr 19th, 2010 at 03:20 PM. Reason: Change of query

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: UpdateProgress not working under Updatepanel control.?

    Hey,

    Can you go back and edit your post and put [CODE][/CODE] tags around your code? It would make it so much easier to read!!

    Gary

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: UpdateProgress not working under Updatepanel control.?

    Normally when you add any PostBackTrigger to your updatepanel the updateprogress won't display. You have to display it explicitly.Add a javascript to show the update progress.

    1.Add one ProgressLabel to your form(lblProgress).
    2.If you want to validation, you can call in the Scriptvalidation string.
    3.In the code behind you have add one javascript event for this
    Code:
     btnSave.Attributes.Add("OnClick", String.Format("{1};this.disabled = true;document.getElementById('lblProgress').innerHTML='Please wait as the vehicle is being moved...'; {0};", ClientScript.GetPostBackEventReference(btnSave, Nothing), ScriptValidation))
    The above function will disble the button which caused the postback as long as the process is happening.
    And the progress is shown. If you want to do some validation you could add in ScriptValidation string

    And in the Page Design view add this javascript

    Code:
     <script language="javascript" type="text/javascript">
                function displaywaitmsg()
                {
                  var objProgress=document.getElementById("lblProgress");
                  if (objProgress != null && objProgress != undefined)
                  {
                     objProgress.innerHTML="Loading...";
                  }
                }
    </script>
    Please mark you thread resolved using the Thread Tools as shown

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: UpdateProgress not working under Updatepanel control.?

    File Upload controls don't work straight away in UpdatePanels as they're a bit more complicated than simple partial-postbacks. Have a look here:

    http://geekswithblogs.net/ranganh/ar....net-ajax.aspx


    You could also use the AsyncFileUpload control which is part of the latest ASP.NET AJAX build:
    http://www.asp.net/ajax/ajaxcontrolt...ileUpload.aspx

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: UpdateProgress not working under Updatepanel control.?

    Quote Originally Posted by danasegarane View Post
    Normally when you add any PostBackTrigger to your updatepanel the updateprogress won't display. You have to display it explicitly.Add a javascript to show the update progress.

    1.Add one ProgressLabel to your form(lblProgress).
    2.If you want to validation, you can call in the Scriptvalidation string.
    3.In the code behind you have add one javascript event for this
    Code:
     btnSave.Attributes.Add("OnClick", String.Format("{1};this.disabled = true;document.getElementById('lblProgress').innerHTML='Please wait as the vehicle is being moved...'; {0};", ClientScript.GetPostBackEventReference(btnSave, Nothing), ScriptValidation))
    The above function will disble the button which caused the postback as long as the process is happening.
    And the progress is shown. If you want to do some validation you could add in ScriptValidation string

    And in the Page Design view add this javascript

    Code:
     <script language="javascript" type="text/javascript">
                function displaywaitmsg()
                {
                  var objProgress=document.getElementById("lblProgress");
                  if (objProgress != null && objProgress != undefined)
                  {
                     objProgress.innerHTML="Loading...";
                  }
                }
    </script>
    Well I have inserted code as you guided
    but I am geeting error as "Index (zero based) must be greater than or equal to zero and less than the size of the argument list."
    and the code modified as
    Code:
     btnAdd.Attributes.Add("OnClick", String.Format("{1};this.disabled = true;document.getElementById('lblProgress').innerHTML='Please wait...'; {0};",ClientScript.GetPostBackEventReference(btnAdd,"Loading...")));

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: UpdateProgress not working under Updatepanel control.?

    *jumps up and down and waves arms in the air*

    Did you see my post and those links?

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: UpdateProgress not working under Updatepanel control.?

    Quote Originally Posted by mendhak View Post
    *jumps up and down and waves arms in the air*

    Did you see my post and those links?
    I am going to go with no

  8. #8
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: UpdateProgress not working under Updatepanel control.?

    Try this one...

    Code:
    btnSave.Attributes.Add("OnClick", String.Format("{1};this.disabled = true;document.getElementById('lblProgress').innerHTML='Please wait as the vehicle is being moved...'; {0};", ClientScript.GetPostBackEventReference(btnSave, Nothing), ""))
    Please mark you thread resolved using the Thread Tools as shown

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    Re: UpdateProgress not working under Updatepanel control.?

    Quote Originally Posted by danasegarane View Post
    Try this one...

    Code:
    btnSave.Attributes.Add("OnClick", String.Format("{1};this.disabled = true;document.getElementById('lblProgress').innerHTML='Please wait as the vehicle is being moved...'; {0};", ClientScript.GetPostBackEventReference(btnSave, Nothing), ""))
    Thanks for the great help..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width