[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%;">
<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" />
</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
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
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>
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
Re: UpdateProgress not working under Updatepanel control.?
Quote:
Originally Posted by
danasegarane
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...")));
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?
Re: UpdateProgress not working under Updatepanel control.?
Quote:
Originally Posted by
mendhak
*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 :D
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), ""))
Re: UpdateProgress not working under Updatepanel control.?
Quote:
Originally Posted by
danasegarane
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..