Hi sir,
Tell me the steps to show update progress while uploading file content to sql server database. I have
40,000 records in excel file, i upload the records into the database, i need to show update progress
while uploading the records into database, its working fine but i cant able to view the update progress.
I attached the code for further details. Kindly give me the solution for this problem.
Homes.aspx:
**************
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<br />
<br />
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table align="center">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Please select the file"></asp:Label>
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td align="center" colspan="3">
<%--<asp:GridView ID="GridView1" runat="server">
</asp:GridView>--%>
<asp:Label ID="lbl_count" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="center" colspan="3">
</td>
</tr>
</table>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Upload" OnClientClick="javascript:showWait();" />
<asp:UpdateProgress AssociatedUpdatePanelID="UpdatePanel1" ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/ajax-loader.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
<%-- <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />--%>
</Triggers>
</asp:UpdatePanel>
<br />
<br />
Homes.aspx.cs
**************************
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
if (FileUpload1.HasFile)
{
string filename = FileUpload1.FileName;
if (System.IO.File.Exists(Server.MapPath(filename)))
{
System.IO.File.Delete(Server.MapPath(filename));
}
string count;
FileUpload1.SaveAs(Server.MapPath(filename));
import_excel(Server.MapPath(filename), out count);
lbl_count.Text = count;
}
}
With regards,
J.Prabu.
[Email:prbspark@gmail.com]