CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 9/27/2007 3:09:48 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 60 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
thyphoon1
Asp.Net User
Call a function in a MasterPage from the child page9/27/2007 3:09:48 PM

0/0

Hi,

I have a function in my master page and i want to call it from a "child" page....

 What i must to do ?

 thanks

ps2goat
Asp.Net User
Re: Call a function in a MasterPage from the child page9/27/2007 4:14:25 PM

0/0

Make sure the function is accessible to the page (i.e. declared public), and use the MasterType declaration in the ContentPage:

 

<%@ Page .... %>
<%@ MasterType VirtualPath="~/masterpage.master" %>

 

In the page, use Page.Master.MyFunction() to access the function.

*Note: before being able to access the function, you'll need to save & build.


---------------------------------------
MCP - Web Based Client Development .NET 2.0
thyphoon1
Asp.Net User
Re: Call a function in a MasterPage from the child page9/27/2007 4:17:40 PM

0/0

 

 

right ;-)

scott@elbandit.
Asp.Net User
Re: Call a function in a MasterPage from the child page9/27/2007 4:19:26 PM

0/0

Code on masterpage, master page is called MyMasterPage:

Public Sub dothis() 
     Response.Write(
"bgbb")
End Sub


Code on Child page:

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

       Dim aMP As MyMasterPage = CType(Me.Master, MyMasterPage)

       aMP.dothis()

End Sub


--------------------------------------------------------
Don't forget to click "Mark as Answer" on the post(s) that helped you.

Scott ASP.net blog

docluv
Asp.Net User
Re: Call a function in a MasterPage from the child page9/27/2007 6:09:05 PM

0/0

This is one of my Blog entries on how to bind to the events of a Master page in the child page.

http://professionalaspnet.com/archive/2007/01/11/Handling-Master-Page-Click-Events-in-the-Content-Page.aspx


Chris Love
Amanda Wang - M
Asp.Net User
Re: Call a function in a MasterPage from the child page10/1/2007 3:07:20 AM

0/0

Hi 

thyphoon1:

I have a function in my master page and i want to call it from a "child" page....

You can refer scorpioafrica's post on this thread: http://forums.asp.net/p/1157414/1904247.aspx#1904247

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Learning ASP.NET 3.5 Authors: Jesse Liberty, Dan Hurwitz, Brian MacDonald, Pages: 576, Published: 2008
Understanding the Linux Kernel: [from I/O Ports to Process Management]. Authors: Daniel Pierre Bovet, Marco Cesati, Pages: 923, Published: 2006
Programming ASP.NET: Building Web Applications and Services with ASP.NET 2.0 Authors: Jesse Liberty, Dan Hurwitz, Pages: 930, Published: 2005
The Complete Works Authors: William Shakespeare, Stephen Orgel, A. R. Braunmuller, Pages: 1754, Published: 2002
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007

Web:
Access Child page from MasterPage - ASP.NET Forums How can I access or call functions located in child page from a master page? ... I don't know how to call a function from a master page, so that's how I'd ...
Model popup in master page not updating the child page list box ... When master page is loaded with inner child page, the child page has list ... at the bottom of page are not rendered on the page and calling the function ...
javascript to call on MasterPage onload - bytes Nov 7, 2007 ... function call (function is in master page) with UpdatePanel of Page? ... If you want to call script manager from child pages or user ...
AJAX Not working in Particular Masterpages You can handle the postback on the master page or the child pages as you see fit . .... function GetServerTime() { alert("calling"); AJAXInterop. ...
C# Adding MetaData to Master page from Child page dynamically ... Oct 28, 2008 ... Then when you call the accessor from the child page to set the value, on the master page OnPreRender() method the meta data will be added to ...
Using Master Page and the page.header is showing up as nothing ... In the function call you may notic swuh, this is simple the .... of the masterpage and then use that content holder in the child page? ...
CodeProject: Master Pages and JavaScript document.getElementById ... Whenever a control is inside a Master Page, the client ID of the control would get ... call the function with the control to be accessed as the parameter. ...
NEED HELP!! Stuck on Master page - DevX.com Forums You posted the masterpage only. There may be something wrong with the way you call the procedure in your home page. ...
ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps Apr 11, 2006 ... However, by the time the Init event fires the master page becomes just another child control inside the page. In fact, the MasterPage class ...




Search This Site:










how can i use the web site admin tool on the server?

how to include methods (sub xxx, sub yyy) in multiple aspx pages?

multi databound drop boxes

calling com component from asp.net 1.1

how to use an already existing membership datatable as authentication in asp.net 2.0?

dynamic checkboxlist - asp.net/c#

problem with adding datarow to datatable using c# !

loop not appearing!

threading a mailing procedure

best way to access the database and set up queries using .net

server out of resource

time comparisons on c#....show error between certain times

object

exception bipass?

timeout before get results on asp.net2.0 page, how to solve this?

dropdown list

hopefully not a stupid question

console app within web solution

how to locate an error on page when running a webform

setting treeview parent nodes links/controling node links

buildproviderappliesto

regular expression help

very simple display problem

no error in sending emails in ap.net2.0 -still emails are not sent................ why?

textcolor in email body

dns

moving a file from one directory to another

send email in c#

how do i adjust a web application to fit the printout page?

function in asp.net 2.0

  Privacy | Contact Us
All Times Are GMT