Navigate between Views of different Controllers

2 posts, 0 answers
  1. Venu
    Venu avatar
    9 posts
    Member since:
    Aug 2013

    Posted 26 Nov 2016 Link to this post

    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

     

     

  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2774 posts

    Posted 30 Nov 2016 Link to this post

    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.
Back to Top