Custom control

  • Thread starter Thread starter Guest
  • Start date Start date
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/
 
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
 
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.
 
Thanx guys,

Now I have two ideas to do the same thing , better than 0.

:) thnx
 
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

Back
Top