This is a migrated thread and some comments may be shown as answers.

Ajax navigation with ability to link directly to the url of any page. Possible?

8 Answers 133 Views
Application
This is a migrated thread and some comments may be shown as answers.
Miljan
Top achievements
Rank 2
Miljan asked on 20 Sep 2013, 04:54 PM
Hi there,

I am looking into feasibility to create mobile(phone) version of high traffic site with Kendo UI Mobile.

Following this article http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/mobileapplication/overview I was able to create an example navigating pages with ajax. Since the controller is returning PartialView for the page, when you reload the url for the second page, that page seems broken as it doesn't load layout.  

I was able to workaround that with this code
            if (Request.IsAjaxRequest())
                            return PartialView();
             return View();

But when I load that second page directly, link to the third page got messed up (showing the route data and appending relative url)
Everything works well though when I set PushState to false, but in that case # is added to the url.
 
Is my approach wrong, or there is different setup for ajax navigation with ability to load inside pages by typing the url?

Any help would be appreciated.

Thanks.

8 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 23 Sep 2013, 12:16 PM
Hello Miljan,

The recently released Kendo UI Service Pack should address that issue. You can downloaded from your account and give it a try.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Miljan
Top achievements
Rank 2
answered on 23 Sep 2013, 06:57 PM
I downloaded the latest version 2013.2.918.340, tried the same thing, but it didn't work as expected.

I've created simple example. Code below.

From home page there is a Navigate to Details link which loads /home/details/1. On the details page you can navigate to the next one with incremented id /home/details/2, /home/details/3, .... All works fine until you try to load for example /home/details/3 without going through homepage, and then try to navigate to next item. The url got messed up and next link is not working.

Thank you so much.

Miljan

HomeController.cs
public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Details()
        {
            ViewBag.NextID = (Convert.ToInt32(RouteData.Values["id"])) + 1;
            if (Request.IsAjaxRequest()){
                ViewBag.ShowBackButton = true;
                return PartialView();
            }
            return View();
        }
    }

Index.cshtml
@(Html.Kendo().MobileView()
    .Name("Index")  
    .Title("Index")
    .Content(
        @<text>
        @(Html.Kendo().MobileButton()
            .Text("Details")
            .Url("/home/details/1")            
        )
        </text>
    )
)

Details.cshtml
@(Html.Kendo().MobileView()
    .Title("Details")    
    .Name("Details")    
    .Content(
        @<text>
        View Details Template                
        @(Html.Kendo().MobileButton()
            .Text("Go Back")
            .Url("#:back")
        )
        @(Html.Kendo().MobileButton()
            .Text("Next")
            .Url("/home/details/" + ViewBag.NextID)
        )
        </text>
    )
)
_Layout.cshtml
@(Html.Kendo().MobileApplication()
                    .PushState(true)
                    .ServerNavigation(false)
                )






0
Nikolay Rusev
Telerik team
answered on 25 Sep 2013, 07:33 AM
Hello Miljan,

For your convenience I've create a sample project. Navigation seems to be working properly here. Please give it a try and let me know how it goes.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Miljan
Top achievements
Rank 2
answered on 26 Sep 2013, 04:18 PM
Thanks, Nikolay!

I've updated your example with the code I pasted here previously, and also recorded a screencast of the problem I am experiencing.

Here is the screencast http://screencast.com/t/Lra3QdvA5o26

Miljan

0
Nikolay Rusev
Telerik team
answered on 30 Sep 2013, 08:28 AM
Hello Miljan,

I'm afraid that we will need more time to investigate this behavior further. I'll post in this thread once we have more details for this case.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Miljan
Top achievements
Rank 2
answered on 15 Oct 2013, 05:37 PM
Any word on this?

Thanks,
Miljan
0
Accepted
Nikolay Rusev
Telerik team
answered on 16 Oct 2013, 08:38 AM
Hello Miljan,

Latest Internal build available should contain a fix for the issue. At least that's what my tests shows. 
For your convenience I'm attaching upgraded version of the project.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Miljan
Top achievements
Rank 2
answered on 17 Oct 2013, 10:10 PM
My first tests also shows that it works correctly now.

Much appreciated.

Thanks,
Miljan

Tags
Application
Asked by
Miljan
Top achievements
Rank 2
Answers by
Nikolay Rusev
Telerik team
Miljan
Top achievements
Rank 2
Share this question
or