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

app.navigate in MVC

2 Answers 136 Views
Application
This is a migrated thread and some comments may be shown as answers.
Gert
Top achievements
Rank 1
Gert asked on 10 Dec 2013, 08:50 AM
I have been searching for how to do this, but am unable to find the right answer.

In JavaScript I can do this:

var app = new kendo.mobile.Application();

Then use the app variable to navigate between pages.

But how do I do this in MVC? I can't set the MVC razor tag to a JavaScript variable, so how do I call .navigate after doing:

@(Html.Kendo().MobileApplication()
        .Name("KendoMobileApplication")
        .PushState(true)
        .Transition("slide")
        .ServerNavigation(false)
        .Layout("databinding")
        )

I have tried this, but it seems less than ideal that I create a new application every time I navigate:

var app = new kendo.mobile.Application();
app.navigate("/Home/AccountType");

I've also tried

$("#KendoMobileApplication").context.navigate("/Home/AccountType");

But that doesn't work. It has no navigate method.

So what is the correct way of doing this?

2 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 10 Dec 2013, 12:30 PM
Hi Gert,

You can get a reference of the already created application using this approach and then you can use the navigate() method to perform navigation:

http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/mobileapplication/overview#getting-reference-to-the-kendo-ui-mobileapplication-widget

Please keep in mind that it is really important not to create more than one mobile applications in your project, as this can cause multiple errors and unexpected behavior.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gert
Top achievements
Rank 1
answered on 11 Dec 2013, 02:42 PM
Thanks! That was exactly what I was looking for, but was unable to find. Now it works as expected :)
Tags
Application
Asked by
Gert
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Gert
Top achievements
Rank 1
Share this question
or