Wednesday, March 28, 2012

UpdateProgress problem with December CTP

Hi, can someone please tell me why the UpdateProgress doesn't apear?

<%@dotnet.itags.org. 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 Page_Load(object sender, EventArgs e) {
btn.Click += new EventHandler(btn_Click);
}

void btn_Click(object sender, EventArgs e) {
System.Threading.Thread.Sleep(1000);
}
</script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<div>
<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger EventName="Click" ControlID="btn" />
</Triggers>
<ContentTemplate>
<%= DateTime.Now.ToString() %>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btn" runat="server" Text="Button" />
<asp:UpdateProgress ID="progress" runat="server" AssociatedUpdatePanelID="up1">
<ProgressTemplate>
<span>Loading...</span>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</form>
</body>
</html>

Hey :)

is this a known problem or I'm doing something wrong?


I've readthis post but this is not what I want. I want every update panel on my page to have it's own update progress. Something like this:

<%@. Page Language="C#" %
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
btn1.Click += new EventHandler(btn_Click);
btn2.Click += new EventHandler(btn_Click);
}

void btn_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
}

</script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<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:Button ID="btn1" runat="server" Text="Btn1" />

<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="panel1" runat="server" style="background-color:#ccc;">
<%= DateTime.Now.ToString() %>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel
<asp:UpdateProgress ID="uProgress1" AssociatedUpdatePanelID="up1" runat="server">
<ProgressTemplate>
<span>Loading panel 1</span>
</ProgressTemplate>
</asp:UpdateProgress
<br /
<asp:Button ID="btn2" runat="server" Text="Btn2" /
<asp:UpdatePanel ID="up2" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn2" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="panel2" runat="server" style="background-color:red;">
<%= DateTime.Now.ToString() %>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel
<asp:UpdateProgress ID="uProgress2" AssociatedUpdatePanelID="up2" runat="server">
<ProgressTemplate>
<span>Loading panel 2</span>
</ProgressTemplate>
</asp:UpdateProgress
<div>
</div>
</form>
</body>
</html

How to make this work? And the trigger buttons to be outsite the update panels...

10x


I've just read that :)

You can associate theUpdateProgress control with a singleUpdatePanel control by setting the progress control'sAssociatedUpdatePanelID property. In that case, theUpdateProgress control displays a message only when a postback originates inside the associatedUpdatePanel control.

sorry :)

No comments:

Post a Comment