Opening Bootstrap modal from URL in grid column

2 posts, 0 answers
  1. ImNotTed
    ImNotTed avatar
    11 posts
    Member since:
    Oct 2013

    Posted 29 Apr 2016 Link to this post

    I would like to show a clickable URL within a Kendo Grid that opens a bootstrap modal. Unfortunately, when the user clicks on this link, the browser navigates to a new page to show the results.

    The code below is supposed to open a partial view that would load the proper data for the specified LotId.

    Any help would be greatly welcomed.

    Thanks!

    @(Html.Kendo().Grid<LotViewModel>()
          .Name("LotGrid")
          .Columns(columns =>
          {
            columns.Bound(x => x.LotName).ClientTemplate(@Html.ActionLink("#=LotName#", "ShowLotModal", "Lot", new { id = "#=LotId#" }, null));

    })

    // Etc...

  2. Dimo
    Admin
    Dimo avatar
    8474 posts

    Posted 03 May 2016 Link to this post

    Hello,

    The Bootstrap modal should be opened with a JavaScript click handler, attached to the ActionLink. Currently, it appears that such a handler is not used. The Grid's dataBound event can be used to attach the event handler, unless you prefer an "onclick" attribute.

    http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/overview#event-handling

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-dataBound

    Since the discussed development task is not directly related to Kendo UI, my recommendation is to achieve the desired behavior with an ActionLink outside the Grid, and then integrate the functionality with the Grid. Let me know if you have any problems with the last step.

    Regards,
    Dimo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top