AJAX Master page issue.

  • Thread starter Thread starter scottingim
  • Start date Start date
S

scottingim

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
(e-mail address removed) (remove the appropriate parts before
sending. ;) )
 
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.
 
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.
 
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)
 
as the updateprogess is not in the update panel (the only html modified ona
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.
 
Back
Top