ClientTemplate using #

2 posts, 1 answers
  1. Allan
    Allan avatar
    34 posts
    Member since:
    Aug 2015

    Posted 26 Feb 2016 Link to this post

    I want to give something a data-target value in my grid results.  I used a client template to achieve this but I cannot give the data-target an identifier, as soon as I type data-target=''#mymodal' the system crashes and the grid breaks and fails to load.  Is there anyway to include a # in my client template that won't breakt he grid?


          .Columns(columns =>
              columns.Bound(c => c.owner_company);          
              columns.Bound(c => c.vessel_status);
              columns.Command(command => { command.Edit(); }).Width(180);
              columns.Bound(c => c.vessel_idx)
                   "<a href='" + Url.Action("Create", "Fixture") + "/#=vessel_idx #'" + ">Fixture</a>");
              columns.Bound(c => c.vessel_idx)
                   "<a data-toggle='modal' data-target='#myModal' href='" + Url.Action("Create", "Fixture") + "/#=vessel_idx #'" + ">Details</a>");
          .Editable(editable => editable.Mode(GridEditMode.InLine))
          .Reorderable(reorder => reorder.Columns(true))
          .DataSource(dataSource => dataSource
              .Model(model =>
                      model.Id(p => p.vessel_idx);
              .Read(read => read.Action("vessels_Read", "BrokerHome"))
              .Update(update => update.Action("vessels_Update", "BrokerHome"))




  2. Answer
    Dimiter Madjarov
    Dimiter Madjarov avatar
    2211 posts

    Posted 26 Feb 2016 Link to this post

    Hello Allan,

    The # symbols which are not part of the template syntax should be escaped.

    .ClientTemplate("<a data-toggle='modal' data-target='\\#myModal'

    Dimiter Madjarov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top