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" })
)
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" })
)