Master Page and Update Panel problem

Posted on 2007-10-03
Last Modified: 2013-11-07
Good morning Experts,
I have a Master page with a script mgr on it and a Content page with an Update Panel.
On the Master page i have a textbox (ID = txtSearchByNumber)  
and a imagebutton (ID= ibtnSearchByQuote) .
I expose the textbox.text property on the master page as QuoteNumber.  
I registered the imagebutton click event like this: ScriptManager1.RegisterAsyncPostBackControl(ibtnSearchByQuote)
I have this tag on the Content page: <%@ mastertype virtualpath="~/Quote.master" %>
In the Page Load of the Content page, I am able to get the value of the textbox from the Master Page by
I run a Select statement using the Master.QuoteNumber value in my where clause.  All seems well.  All the textboxes are set with the proper values when I step throug the code behind of the Content page.  
Problem is that the Master Page seems to load again and the  changes are wiped out
HELP !!!
Question by:katzhoward
    LVL 12

    Expert Comment

    The Master Page Load always occurs after the content Page Load event.  The Page_LoadComplete event of the content page occurs after master page load.

    Author Comment

    So, what should I do differently?
    LVL 12

    Expert Comment

    Instead of running your select statement in the page load event, run it in the page loadcomplete event.

    Author Comment

    In the Master or Content page? I have gotten it to work but I ran it in the Page_load event of the Master page.  It was quite cumbersome because I had to create instances of each control type and then do a FindControl. Here is ex:
                    Dim DOA As TextBox = MainContent.FindControl("CL1_f_48")
                    DOA.Text = MyReader("f_48")

    Could you be a bit more explicit.  
    LVL 12

    Accepted Solution

    In the Content page,

      Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
             DOA.Text = MyReader(Master.QuoteNumber)
      End Sub

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now