locked
UrlRouting for internal links in Dynamic Data RRS feed

  • Question

  • User561778552 posted

    How can I use asp.net 4.0 routing scheme to navigate an internal links in other page

    the original page is something like this about.aspx#CEO I tried a lot with about/CEO

    no way!!

    Saturday, November 24, 2012 9:55 AM

All replies

  • User-330204900 posted

    Are these internal pages other DD pages?

    Saturday, November 24, 2012 10:04 AM
  • User561778552 posted

    internal link not pages...

    suppose i have aboutus page inside it i have internal link ,suppose i have a menu in default page ,in that menu there is aboutus page and subminue from it clled CEO,from this link how i can navigate to CEO part in aboutus page .

    did u get it ??

    Saturday, November 24, 2012 10:42 AM
  • User-330204900 posted

    OK I generally use the Rquest to get the current URL and then you could append the internal url like this

    Page.Request.UrlReferrer.PathAndQuery

    you can then do

    If(!IsPostBack)
        HyperLink1.NavigateUrl = Page.Request.UrlReferrer.PathAndQuery + "#CEO";

    hope that helps you need to do this in the page init or load.

     

    Saturday, November 24, 2012 10:53 AM
  • User3866881 posted

    Web Developer1

    Hi,

    I come here to check whether the problem is solved by the nice MVP or not……Welcome to feedback in detail information.

    Saturday, November 24, 2012 9:58 PM
  • User561778552 posted

    Thanks in advance Decker Dong but still nor solved i'm trying to solve it ...

    Sunday, November 25, 2012 8:25 AM
  • User3866881 posted

    So can you show your codes?

    Sunday, November 25, 2012 8:27 PM
  • User-292752494 posted

    Hi sjnaughton

    I wanna clarify the question, assume you have a page named "About.aspx" it contains many internal links as example "CEO", the problem come when I try to access the internal link via a proper route "/About/CEO". How can I map that route to the original link "About.aspx#CEO

    Monday, November 26, 2012 3:42 AM
  • User-330204900 posted

    Hi Hisham, this issue here is a DynamicData page template is routed as a DynamicDataRoute and so does not follow the same as a normal web form.

    Monday, November 26, 2012 5:23 AM
  • User-292752494 posted

    Hi ...

    Assume I have a web form in CustomPages folder and contacins two sections, how can i route to the internal link to reach the 2nd section?!!

    Monday, November 26, 2012 5:31 AM
  • User-330204900 posted

    I would add a static ID to your section you can do this by surrounding by a DIV or setting

    ClientIDMode="Static"
    

    then as I showed above use the Request URL and add #<ID> where ID is the statics ID of the html element :)

    Monday, November 26, 2012 5:52 AM
  • User-292752494 posted

    Hi ...

    The problem which I facing in routing, this is what i wrote in global.asax

      routes.MapPageRoute("test", "About", "~/About.aspx#CEO");



    Monday, November 26, 2012 6:30 AM
  • User-330204900 posted

    to generate routes like that you will need to write you own custom Route Handler as I do not believe the default one will handle the #

    Monday, November 26, 2012 7:07 AM
  • User-292752494 posted

    Hi ..

    Do you think Microsoft forgot this situation?!! I did a trcik using

    window.location.hash

    but i'm still fighting to find a solution using pure routing technique ..

    Monday, November 26, 2012 7:32 AM
  • User-330204900 posted

    It's not something I have ever thought about using before this thread, I am however thinking about it now though, I will try and have a lok today.

    Monday, November 26, 2012 7:35 AM