Remote views with Razor url structure

5 posts, 0 answers
  1. oVan
    oVan avatar
    35 posts
    Member since:
    Apr 2008

    Posted 13 Jul 2012 Link to this post

    Hi,

    I understand that the default navigation is hash navigation in a single page, and that remote views are pulled in via Ajax.

    In Razor WebPages, you can define any seo-friendly url structure just by making sure file exists, and all extra parts of the url are passed in as parameters (eg. mysite.com/products/1/detail -> products.cshtml will accept this and have UrlData[0]="1" & UrlData[1]="detail"). 

    I want to keep using this very handy url system combined with the mobile output of Kendo. So, I'm wondering how you handle the common scenario that a visitor browses to a direct url. As you don't include the Kendo styles & scripts in remote views, the visitor will only see unstyled html.

    Thanks for any help!
    o.
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 18 Jul 2012 Link to this post

    Hello Olivier,

    As I understood it you would like to link to external pages (like http://example.com/views/details) instead of working with the build in navigation that uses the view id prefixed with # symbol. To achieve this you should set the data-rel="external" attribute to the respective link element.

    <a href="http://kendoui.com/" data-rel="external">Visit KendoUI</a>

    I would not recommend using this feature to navigate between the views though, because in this case you would have to include the scripts/styles and initialize a new kendo mobile application in every external view (which will be a performance hit for the mobile device). Navigation to external link is like leaving the mobile application and loading a new web page.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. oVan
    oVan avatar
    35 posts
    Member since:
    Apr 2008

    Posted 18 Jul 2012 Link to this post

    Hi Alexander,

    That is exactly my concern. We're doing the same with jQuery Mobile and I want to avoid that.

    But, the client wants to use seo-friendly urls that link to a specific house for sale (http://m.whatever.com/for-sale/55/house-with-2-bedrooms)

    How would you approach this with Kendo? Is there a solution with the hash navigation, like http://m.whatever.com/#for-sale/55/house...?

    Thank you for your reply! 
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 19 Jul 2012 Link to this post

    Hello Olivier,

    I am afraid that what you are trying to achieve is not possible - the mobile application do not support other type of navigation between mobile views. A similar type of URL could be achieved only if the requested remote view file is located in nested folders - for example:
    //root folder
    index.html
        > for-sale
            > 55
                > house.html
     
    //the displayed url will have the following format
    www.m.site.com/#for-sale/55/house.html


    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. oVan
    oVan avatar
    35 posts
    Member since:
    Apr 2008

    Posted 21 Jul 2012 Link to this post

    If I understand your answer correctly, the url after the hash # is loaded by the application. That should make it possible to use Razor WebPages url structure. On the other hand, it should be possible to write a one-line jQuery script to check if the Kendo app is already loaded. That would solve the problem when someone directly navigates to a deep linked page, a redirect would be possible: eg. http://m.mysite.com/products/table/14 -> http://m.mysite.com/#products/table/14 Maybe I'll create a little test to see if it works.
Back to Top
Kendo UI is VS 2017 Ready