Button click event

4 posts, 0 answers
  1. Uma
    Uma avatar
    3 posts
    Member since:
    Jun 2014

    Posted 30 Jul 2014 Link to this post

    Hi,

    I have a view with telerik asp.net mvc button on it. When the user clicks on this button, I would like to redirect to another view. I looked into the control documentation but could not find anything in the Events section. Please help me.
    Below is my button code for reference.

    <div style="text-align:right">
        @(Html.Kendo().Button()
        .Name("add")
        .Content("Add Project")
        .HtmlAttributes(new { type = "button" })
        .Events(e => e.Click("GoToCreateView")))
    </div>

    Thanks.
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 30 Jul 2014 Link to this post

    Hello Uma,


    Indeed in the current case you could use the click event of the Button widget and navigate to the view in the event handler.

    Let me know if I could assist further on this topic.

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Cyril
    Cyril avatar
    1 posts
    Member since:
    Jun 2014

    Posted 21 Oct 2014 Link to this post

    I am new to MVC/cshtml and I have the same issue. I am struggling to get the script to load a new view when the button is clicked.
    Would you be able to show me an example of the script code inside the click event handler to navigate to a new view? 
  5. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 22 Oct 2014 Link to this post

    Hello Cyril,


    You could navigate via JavaScript in the event handler.
    E.g.
    function onButtonClick(){
        window.location.href = "..."; //pass the desired url for the view
    }

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready