I have set up a updateprogress on my master page. It contains a
label, so I can give page-appropriate messages while updates are going
on. However, I cannot update the label.
Here is the master page:
<body>
<form id="Main" method="post" runat="server">
<div class="Header"></div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></
asp:ScriptManager>
<asp:UpdatePanel ID="upnlMain" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<div style="width:100%; height: 216px; font-size:medium"
align=center>
<br />
<asp:label id="lblMessage" runat="server" Width="100%" Font-
Size="X-Large"></asp:label>
<asp:UpdateProgress ID="UpdateProgress1"
runat="server" >
<ProgressTemplate>
<asp:Label ID="lblProgressMsg"
runat="server" Text="An update is in progress...">
</asp:Label>
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<asp:ContentPlaceHolder ID="cphMain"
runat="server">
</asp:ContentPlaceHolder>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
Here is the code to try to change lblProgressMsg:
Dim up1 As UpdatePanel = DirectCast(Master.FindControl("upnlMain"),
UpdatePanel)
If Not (up1 Is Nothing) Then
Dim up2 As UpdateProgress =
DirectCast(up1.FindControl("UpdateProgress1"), UpdateProgress)
If Not (up2 Is Nothing) Then
Dim lblProgressMsg1 As Label =
DirectCast(up2.FindControl("lblProgressMsg"), Label)
If Not (lblProgressMsg1 Is Nothing) Then
Update_Message("Changing")
lblProgressMsg1.Text = "Hello"
Else
Update_Message("Label is Nothing")
End If
Else
Update_Message("up2 is Nothing")
End If
Else
Update_Message("up1 is Nothing")
End If
Update_Message sub finds and update lblMessage. This works correctly
EVERY time.
However, lblMessage ALWAYS says "Label is Nothing", no matter what I
try.
Any ideas or suggestions?
Thanx in advance,
Stephen Cottingim
scottingim@nospam.hotmail.com (remove the appropriate parts before
sending. ;) )
cfps.Christian - 22 Apr 2008 19:50 GMT
The only thing I can think of is that you're updating the label and
then somewhere in your updatepanel.load event or your page.load event
you're changing it back.
scottingim@hotmail.com - 22 Apr 2008 20:21 GMT
> The only thing I can think of is that you're updating the label and
> then somewhere in your updatepanel.load event or your page.load event
> you're changing it back.
I think you misunderstood my message. lblMessage, a generic label on
the page for page messages to the reader, always says "Label is
Nothing" That means that it cannot find lblProgressMsg, the label in
the UpdateProgress object, which is what I am trying to update.
bruce barker - 22 Apr 2008 21:08 GMT
as the updateprogess is not in the update panel (the only html modified on a
aync postback), its label is fixed at the first render. an async postback
that updates the master page control have no effect as its html is not
re-rendered
-- bruce (sqlwork.com)
> I have set up a updateprogress on my master page. It contains a
> label, so I can give page-appropriate messages while updates are going
[quoted text clipped - 66 lines]
> scottingim@nospam.hotmail.com (remove the appropriate parts before
> sending. ;) )
scottingim@hotmail.com - 22 Apr 2008 21:34 GMT
On Apr 22, 4:08 pm, bruce barker
<brucebar...@discussions.microsoft.com> wrote:
> as the updateprogess is not in the update panel (the only html modified on a
> aync postback), its label is fixed at the first render. an async postback
> that updates the master page control have no effect as its html is not
> re-rendered
>
> -- bruce (sqlwork.com)
I think I understand what you are saying. However this code is in the
page_load event. I am not trying to change the message after a
submission. I want it to use the same message on every update. I
have tried the code in the load event, the preinit event, and the
prerender even. None of them worked.