Click here to Skip to main content
14,579,188 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I am using master page in my application having a child page where master has the menu.

The problem started a few days back when I tried to mould some design in master page.

Not the master page loads as fresh after child page load leading to removal of properties of child page.

Help required urgently!
Thanks in advance

In master page load event:
If Not IsPostBack Then
            Menu1.Focus()
            Call MenuEnabling()
        End If


And in child page load:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    If varmode = 2 And varmodefor = "CreateActivity" Then
        varmode = 2
    Else
        varmode = 1
    End If


    If Not IsPostBack Then

        If varmode = 1 Then
            btnDelete.Visible = False
            Call fnPersons()    
            txtSubject.Focus()
        ElseIf varmode = 2 Then
            btnDelete.Visible = False
            Call fnPersons()
            Call fnActivityDetails(varActivityID)
            txtSubject.Focus()
        End If

    End If
Posted
Updated 24-Jun-20 20:19pm
Rate this:
Please Sign up or sign in to vote.

Solution 1

Everytime you refresh the child, whole page loads, master page is simply part that makes the design easier. Master page isn't a page with iframe that loads separately. You can simulate it by having UpdatePanel, but by default, loading master page is expected behavior. Add If not ispostback to master page load so your menu does not reload.

The following is the sequence in which events occur when a master page is merged with a content page:

Content page PreInit event.
Master page controls Init event.
Content controls Init event.

Master page Init event.
Content page Init event.

Content page Load event.
Master page Load event.

Master page controls Load event.
Content page controls Load event.

Content page PreRender event.
Master page PreRender event.

Master page controls PreRender event.
Content page controls PreRender event.

Master page controls Unload event.
Content page controls Unload event.

Master page Unload event.
Content page Unload event.
   
Comments
atul sharma 5126 6-Sep-14 5:08am
   
Thanks for the info!
Rate this:
Please Sign up or sign in to vote.

Solution 2

prevent post back master page when web form with master page open
   
Comments
CHill60 25-Jun-20 4:26am
   
What is this meant to be? If you have a question then use the red "Ask a Question" link at the top of this page. Be sure to read the posting guidelines

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100