Calling a function on a master page from my child page

I have a master page that I am using like a wizard.  at the bottom of my master page I have a BACK and NEXT button.  The pages could be in any order and could be 1 to many pages as the user can customize the steps in the wizard.  I have about 5 different pages that have user controls and such on those pages for the user to enter data, like contact information for the applicant, and then they click next and then the property owner, etc...   I used to have this as seperate pages with pretty much the same code on each page and I am moving it to a master page.

The problem is that when the user clicks next, it needs to save data to the database or perform other functions for the content entered.  But my NEXT button is on my master page.  I would like the next button to call an UPDATE function on my child page before it moves to the next URL for processing.  I am doing this in VB.NET.

Is this possible?
LVL 4
derftoyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
derftoyConnect With a Mentor Author Commented:
Everyone seemed to tell me how to call a function on the master page.  I can do that.  I did find a way around it, but I ran into some other problems with dynamicaly created child pages on a master page that didn't work.  So I scrapped the idea and just added the back and next buttons on each page.  Oh well.
0
 
joeyluCommented:
As general, you can call your page control from master page by using the findcontrol, let's say you have this image button on your master page named "bn_next" with onclick property to bn_Next_Click, and in your child page, there's a label named "LabelMenu"

Protected Sub bn_Next_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
       
        Dim ThisLabel As Label
        ThisLabel = CType(ContentPlaceHolder1.FindControl("LabelMenu"), Label)
        ThisLabel.Text = "Profile"
       
End Sub



you can read more about this from this link, http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx
0
 
derftoyAuthor Commented:
Your sugestion is changing the property of a control.  I want to call an UPDATE method in the Code Behind on the Child page.  That way, any information entered into text boxes and such are entered into the database and then the next event will then redirect to another URL.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
muhammadyasirCommented:
just make a function in another class file and call it from where you like.
0
 
muhammadyasirCommented:
just make a function in another class file and call it from where you like.
0
 
DmitryVasilievCommented:
1. Add public method into your master page code-behind
public void test(){  }

2.Use MasterType directive in your content page
<%@ MasterType VirtualPath="~/MasterPage.master" %>

3. Add call of MasterPage method inside your content page code-behind
Master.test();

Also you can use properties defined in MasterPage if you need ysing the same way.
If you want to access MasterPage controls you need to use FindControl or add MasterPage method like test() described above which able to access controls directly
0
All Courses

From novice to tech pro — start learning today.