Losing single quote symbols after editing values from an edit pop-up (kendo grid)

2 posts, 0 answers
  1. Mireille
    Mireille avatar
    2 posts
    Member since:
    Apr 2016

    Posted 11 Aug Link to this post

    Hi,
    I'm using a kendo grid to display my data.  The grid is editable, through a pop-up.  There is the problem I have : when the data is updated by a user in the pop-up window, if  a textbox contains a quote symbol, the string value is truncated.  The quote symbol is removed from the string and the rest of the string value after the quote symbol is also truncated.  I've tried to find a solution or a work-around, without success.  The data is lost before the data is sent to the controller Save/Post method.  Do you know a solution for this problem ?
    There is the kendo grid declaration code :

    @(Html.Kendo().Grid<Program.LevelModel>()
     .Name("MyLevels")
     .Columns(columns =>
     {
     columns.Bound(p => p.LevelId)
     .Visible(false);
     columns.Bound(p => p.Level)
     .Visible(false);
     columns.Template(@<text></text>)
     .ClientTemplate("#= LevelDisplayed # <input type='hidden' name='AlertLevels[#= indexGrid(data, 'MyLevels')#].Level' value='#= Level #' />" +
     "<input type='hidden' name='AlertLevels[#= indexGrid(data, 'MyLevels')#].LevelId' value='#= LevelId #' />" +
     "<input type='hidden' name='AlertLevels[#= indexGrid(data, 'MyLevels')#].AlmostMessageEn' value='#= AlmostMessageEn #' />" +
     "<input type='hidden' name='AlertLevels[#= indexGrid(data, 'MyLevels')#].AlmostMessageFr' value='#= AlmostMessageFr #' />" +
     "<input type='hidden' name='AlertLevels[#= indexGrid(data, 'MyLevels')#].AchievedMessageEn' value='#= AchievedMessageEn #' />" +
     "<input type='hidden' name='AlertLevels[#= indexGrid(data, 'MyLevels')#].AchievedMessageFr' value='#= AchievedMessageFr #' />")
     .HtmlAttributes(new { @class = "hl-align-center" })
     .Width(235)
     .HeaderTemplate(Html.HlText("LEVEL"))
     .HeaderHtmlAttributes(new { @class = "hl-align-center" });
     columns.Command(command => { command.Edit().UpdateText(" ").CancelText(" ").Text(" "); })
     .HtmlAttributes(new { @class = "hl-align-center" })
     .HtmlAttributes(new { style = "text-align: center;" })
     .HeaderHtmlAttributes(new { @class = "hl-align-center" })
     .HeaderTemplate(Html.HlText("MESSAGE_ALMOST_EN"));
     columns.Command(command => { command.Edit().UpdateText(" ").CancelText(" ").Text(" "); })
     .HtmlAttributes(new { @class = "hl-align-center" })
     .HtmlAttributes(new { style = "text-align: center;" })
     .HeaderHtmlAttributes(new { @class = "hl-align-center" })
     .HeaderTemplate(Html.HlText("MESSAGE_ALMOST_FR"));
     columns.Command(command => { command.Edit().UpdateText(" ").CancelText(" ").Text(" "); })
     .HtmlAttributes(new { @class = "hl-align-center" })
     .HtmlAttributes(new { style = "text-align: center;" })
     .HeaderHtmlAttributes(new { @class = "hl-align-center" })
     .HeaderTemplate(Html.HlText("MESSAGE_ACHIEVED_EN"));
    columns.Command(command => { command.Edit().UpdateText(" ").CancelText(" ").Text(" "); })
     .HtmlAttributes(new { @class = "hl-align-center" })
     .HtmlAttributes(new { style = "text-align: center;" })
     .HeaderHtmlAttributes(new { @class = "hl-align-center" })
     .HeaderTemplate(Html.HlText("MESSAGE_ACHIEVED_FR"));
     @*columns.Template(@<text></text>)
     .ClientTemplate("<label class='form-checkbox form-normal form-primary form-text #= DisabledMessageClass #' style='padding-left:0px'> <input type='checkbox' class='chkbx' /> </label>")
     .HeaderHtmlAttributes(new { @class = "hl-align-center" })
     .HeaderTemplate(Html.HlText("MESSAGE_DISABLED_MSG"))
     .HtmlAttributes(new { @class = "hl-align-center" });*@
    columns.Bound(p => p.AlertDisabled)
     .ClientTemplate("<input type='checkbox' id='AlertDisabled' name='AlertDisabled' #= AlertDisabled ? checked='checked': '' # value='#= AlertDisabled #' class='chkbx' onchange='alertDisabledClick(this)' />" +
     "<input type='hidden' name=AlertLevels[#= indexGrid(data, 'MessageLevels')#].AlertDisabled value = '#= AlertDisabled #' />")
     .HtmlAttributes(new { @class = "hl-align-center" })
     .HeaderHtmlAttributes(new { @class = "hl-align-center" });
     })
     .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("AlertSelection"))
     .Events(events => events.Save("onSave"))
     .Events(e => e.Cancel("onCancelEdit"))
     .Events(e => e.Edit("onEdit"))
     .Events(e => e.DataBound("onDataBound"))
     .Navigatable()
     .AutoBind(false)
     .DataSource(dataSource => dataSource
     .Ajax()
     .Read(read => read.Action("Levels_Read", "Program", new { Id = Model.ProgramId }))
     .Model(model =>
     {
     model.Id(p => p.LevelId);
     })
     .Update(update => update.Action("Update", "Program"))
     )
     .HtmlAttributes(new { @class = "k-fixed-grid" })
     )
  2. Niko
    Admin
    Niko avatar
    387 posts

    Posted 15 Aug Link to this post

    Hello Mireille,

    Through the provided code sample I wasn't able to run the scenario that you have described. Are you able to reproduce the same behavior in the online demos - http://demos.telerik.com/kendo-ui/grid/editing-popup?

    It would help if you either create a dojo.telerik.com sample with the described problem or open a support ticket with a sample runnable project attached.

    Regards,
    Niko
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
Back to Top