Calling sub procedure in MasterPage file

Discussion in 'ASP .Net' started by Steven K, Sep 8, 2004.

  1. Steven K

    Steven K Guest

    Hello,

    In my codebehind file, I am trying to call a sub procedure that is in my
    MasterPage, but I am getting an error:

    Error 1: BC30451: Name 'LoadMenu' is not declared.
    c:\inetpub\wwwroot\price_insx\MenuCode.aspx.vb 19

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

    If Not IsPostBack Then
    Call LoadMenu("Hello World")
    End If

    End Sub
    ---

    In my MasterPage:

    Public Sub LoadMenu(ByVal strText As String)
    Response.Write(strText)
    End Sub

    Any help with this would be appreciated.

    --
    Thanks in advance,

    Steven
     
    Steven K, Sep 8, 2004
    #1
    1. Advertising

  2. Steven K

    Karl Guest

    Say your master page is called "Primary.master"
    you could do

    ctype(Master, Primary_master).LoadMenu

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Steven K" <> wrote in message
    news:Ov$...
    > Hello,
    >
    > In my codebehind file, I am trying to call a sub procedure that is in my
    > MasterPage, but I am getting an error:
    >
    > Error 1: BC30451: Name 'LoadMenu' is not declared.
    > c:\inetpub\wwwroot\price_insx\MenuCode.aspx.vb 19
    >
    > ----
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles Me.Load
    >
    > If Not IsPostBack Then
    > Call LoadMenu("Hello World")
    > End If
    >
    > End Sub
    > ---
    >
    > In my MasterPage:
    >
    > Public Sub LoadMenu(ByVal strText As String)
    > Response.Write(strText)
    > End Sub
    >
    > Any help with this would be appreciated.
    >
    > --
    > Thanks in advance,
    >
    > Steven
    >
    >
     
    Karl, Sep 8, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben
    Replies:
    2
    Views:
    904
  2. Jérémy Jeanson
    Replies:
    2
    Views:
    375
    bruce barker
    Nov 21, 2008
  3. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    2,049
    Lawrence D'Oliveiro
    May 20, 2011
  4. Richard Gration

    Legitimate use of calling a sub as &sub

    Richard Gration, Feb 23, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    120
    Brian McCauley
    Feb 23, 2005
  5. Martin Kissner

    Question about sub calling other sub

    Martin Kissner, Mar 4, 2006, in forum: Perl Misc
    Replies:
    8
    Views:
    109
    Martin Kissner
    Mar 9, 2006
Loading...

Share This Page