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

Navigate between Views of different Controllers

1 Answer 212 Views
View
This is a migrated thread and some comments may be shown as answers.
Venu
Top achievements
Rank 1
Venu asked on 26 Nov 2016, 01:19 PM

Scenario:
From SharePoint site ribbon icon click opens a dialog window and loads View1.
On View1 a button click navigates to View2.
On View2 a button click should navigate back to View1.

Problem: The Forward navigation is working fine with the href below

window.location.href = '@Url.Action("Index", "Tab")';

But the backward navigation is not working. I have two different Controllers [HomeController, TabController]

<div class="k-closeDiv">
        @(Html.Kendo().Button()
        .Name("closeButton")
        .Content("Close")
        .HtmlAttributes(new { type = "button" })
        .Events(e => e.Click("onCloseButtonClick"))
        )
    </div>
 
 function onCloseButtonClick() {
        window.location.href = '@Url.Action("Index", "Home")'; //NotWorking..??
    }

I have tried all the available options below.

  1. Here
  2. RedirectToAction("Action","Controller")
  3. RedirectToRoute("routeName") 

No errors but No option is working.

Is this an issue since I am loading views in dialog window.??

Please suggest. Thanks

 

 

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 30 Nov 2016, 08:56 AM
Hi,

What type of dialog is being open? If it hosts it contents in an IFRAME then the window.location.href code should work.
Check that the onCloseButtonClick handler is being executed, by adding an alert or a debugger statement.

You might also want to try to "navigate back" without specifying an URL:
history.go(-1);

I hope this helps.

Regards,
T. Tsonev
Telerik by Progress
Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
Tags
View
Asked by
Venu
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or