Custom control

G

Guest

Hi,

I have a custom control that I have placed on my web page. Every thing works
fine.

I just want to know , how can I find out programmatically the name of the
page thats holding the control. say for example I want to write different
title based on the page being displayed.

so if default.aspx is being displayed the 'header.ascx' would display the
title for default page and if the signin page is displayed I want to show
title for Sign-in page.

Any clue/
 
C

Curt_C [MVP]

dotnettester said:
Hi,

I have a custom control that I have placed on my web page. Every thing works
fine.

I just want to know , how can I find out programmatically the name of the
page thats holding the control. say for example I want to write different
title based on the page being displayed.

so if default.aspx is being displayed the 'header.ascx' would display the
title for default page and if the signin page is displayed I want to show
title for Sign-in page.

Any clue/

Do it the other way... have the control accept a parameter (public
variable) that you pass to it
 
K

Ken Dopierala Jr.

Hi,

Something like this should work:

Dim sPath As String = Request.Path.ToLower
Dim iStart As Integer = sPath.LastIndexOf("/") + 1
Dim sPage As String = sPath.Substring(iStart, sPath.IndexOf(".aspx") -
iStart)

sPage should now hold the name of the page. I havn't tested it though.
Good luck! Ken.
 
J

JJ_377

Request.FilePath gives you something like this:

/domain/folder/nameofwebform.aspx
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top