Can anyone suggest a way of doing the following. Within my navigation I have - widget1 (which links to widget1.aspx) widget2 (which links to widget2.aspx) widget3 (which links to widget3.aspx). If a user clicks the link 'widget2' and arrives at the widget2.aspx, I'm trying to get the script that will look at the URL string, stripout the last part i.e. widget2.aspx as a variable so that I can then say, if variable = widget2.aspx the display the link text but do not link it, otherwise, link it. Thanks
Is this something similar to what you're wanting to do? I have a site with the navigation bar set up as a user control. Whatever the current page is, I just list it, without it being a link. Are you looking for something along those lines?
Considering u r using asp .Net in C#: on aspx: --------- <asp:Label id="lbl" runat="server"/> on C#: ------- if(Request.Url.ToLower().IndexOf("widget2.aspx")>=0) lbl.Text="<a href=widget2.aspx>Widget2</a>"; else lbl.Text="Widget2";
A neat trick with ASP.NET is you can declare your referer as a URI variable type, then it auto-parses out the parts for you ... you can even URI. Parse or TryParse to cast it to a URI I believe...