Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Grid > Custom command button
Telerik MVC Extensions are no longer supported (see this page for reference). In case you have inquiries about Kendo UI Complete for ASP.NET MVC, post them in the pertinent Kendo UI forums.

Not answered Custom command button

Feed from this thread
  • Posted on Mar 28, 2011 (permalink)

    In the mvc grid, is is possible to create an extra command button to do a custom action? I'd like to add a button 'Edit' which doesn't edit inline (like the default command), but redirects the user to another view in which an edit form is shown.

  • Rosen Rosen admin's avatar

    Posted on Mar 28, 2011 (permalink)

    Hello Datamex,

    In order to achieve the desired functionality, you may use a template column which contains a link.

    client template:

    columns.Bound(c => c.CustomerID)
    .ClientTemplate(Html.ActionLink("Click Me", "Edit", "Customer", new { CustomerID = "<#= CustomerID #>" }, null).ToHtmlString());

    server template:
    columns.Bound(c => c.CustomerID).Template(c => {
         %>
         <%=Html.ActionLink("Click Me", "Edit", "Customer", new { c.CustomerID }, null)%>
         <%
     })

    More information about column templates can be found in our help documentation.


    All the best,
    Rosen
    the Telerik team

  • Posted on Mar 28, 2011 (permalink)

    Thanks, but that would render a link right, not a button?

  • Rosen Rosen admin's avatar

    Posted on Mar 29, 2011 (permalink)

    Hi Datamex,

    Generally speaking the button html element will do a post request, thus a form element will be needed or you will need to handle the click event through javascript and navigate to the new page manually. Therefore, the easiest way to do a GET request and have a button like look is to style the anchor html element. You can take a look at such approach in this demo for example, where the select button is an anchor element to which is applied t-button css class, thus it is styled to look like a button.

    Regards,
    Rosen
    the Telerik team

  • Posted on Mar 29, 2011 (permalink)

    Hmmm, I will try that. This is the kind of the reason why I'm still not so sure about MVC. Trivial things like this, just putting a button inside a grid, seem to be a lot harder then they are in just regular ASP.NET. Is it me not understanding the technique, or is it just the way MVC rolls...

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Grid > Custom command button
Related resources for "Custom command button"

ASP.NET MVC Grid Features  |  Documentation  |  Demos  |  Telerik TV ]