Results 1 to 6 of 6

Thread: Ascx Question

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216

    Question Ascx Question

    I have included an ASCX in Page A. What I want to do is tell the ASCX file which page it is on so that it will use that criteria to do a DB lookup.

    Anyone? help...

  2. #2
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    Cape Cod, US
    Posts
    292
    Will Me.Name work?

    Just a quick guess as I'm wandering by the thread...

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    Originally posted by fungi
    Will Me.Name work?

    Just a quick guess as I'm wandering by the thread...
    No such thing. I want the parent name

  4. #4
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    Cape Cod, US
    Posts
    292
    Sorry wishful thinking on my part...

    Well I do know that at a minimum you can extract it from Request.FilePath but there's got to be a better .Netty way...

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    C#:
    PHP Code:
    // This gets the pagename that the control is on.  The format is:
    // ASP.MyPage_aspx
    string pageName this.Page.ToString();
    pageName pageName.Substring(4pageName.Length 4);
    pageName pageName.Substring(0pageName.Length 5);
    // Now the pageName variable should just hold 'MyPage' 
    VB.Net:
    VB Code:
    1. Dim pageName = Me.Page.ToString()
    2. pageName = pageName.Substring(4, pageName.Length - 4)
    3. pageName = pageName.Substring(0, pageName.Length - 5)

    Or you can use something like this:
    Request.Path.ToString()

    It will get you the full path and page of your current page.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width