Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
1.00/5 (1 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:
VB
If Not IsPostBack Then
            Menu1.Focus()
            Call MenuEnabling()
        End If


And in child page load:

VB
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

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.
 
Share this answer
 
Comments
atul sharma 5126 6-Sep-14 5:08am    
Thanks for the info!
prevent post back master page when web form with master page open
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900