S
sandrofurlan
Hi everybody,
I've a problem with an updatepanel.
I'd like to show progress value (from 1 to 10) shown on my form
without page refresh (using Ajax UpdatePanel).
Serialization starts from Serialize button event
Then in the script code section I increment label text value in a for
cycle. But on the video there's no refresh.
I also add a thread.sleep for 1 sec
I post the (simply) code, hope somebody help me:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Serialize_Click(object sender, EventArgs e)
{
for (int i = 1; i < 10; i++)
{
Label1.Text = Convert.ToString(i);
UpdatePanel1.Update();
System.Threading.Thread.Sleep(1000);
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="Serialize" Text="Serialize" runat="server"
OnClick="Serialize_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text="1"
AutoPostBack="true" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
I've a problem with an updatepanel.
I'd like to show progress value (from 1 to 10) shown on my form
without page refresh (using Ajax UpdatePanel).
Serialization starts from Serialize button event
Then in the script code section I increment label text value in a for
cycle. But on the video there's no refresh.
I also add a thread.sleep for 1 sec
I post the (simply) code, hope somebody help me:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Serialize_Click(object sender, EventArgs e)
{
for (int i = 1; i < 10; i++)
{
Label1.Text = Convert.ToString(i);
UpdatePanel1.Update();
System.Threading.Thread.Sleep(1000);
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="Serialize" Text="Serialize" runat="server"
OnClick="Serialize_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text="1"
AutoPostBack="true" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>