Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

AJAX Master page issue.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
scottingim@hotmail.com - 22 Apr 2008 17:20 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.