I have a problem when I try to cancel event handler using webgrid in MVC asp net C#.
This is my code
//Cancel event handler.
$("body").on("click", "#WebGrid TBODY .Cancel", function () {
var row = $(this).closest("tr");
$("td", row).each(function () {
if ($(this).find(".text").length > 0) {
var span = $(this).find(".label2");
var input = $(this).find(".text");
input.val(span.html());
span.show();
input.hide();
}
});
row.find(".Edit").show();
row.find(".Update").hide();
$(this).hide();
});
webGrid.Column(header: "day_gv",
style: "day_gv",
format: @<span>
<span class="label2">@item.day_gv</span>@if (@item.Truefalse)
{<span><input class="text" type="text" value="0000-00-00" style="display:none" disabled /></span>}
else
{<span><input class="text" type="text" value="@item.day_gv" style="display:none" /></span>}
</span>)
webGrid.Column(header: "day_hh",
style: "day_hh",
format: @<span>
<span class="label2">@item.day_hh</span>@if (@item.Truefalse)
{<span><input class="text" type="text" value="0000-00-00" style="display:none" disabled /></span>}
else
{<span><input class="text" type="text" value="@item.day_hh" style="display:none" /></span>}
</span>)
If editing the row where the value of @item.Truefalse is true
the return on webgrid is
If try cancel editing on the same row of @item.Truefalse is true and try to re-open EDIT, the return is empty
The problem it's if cancel editing and re-open EDIT on the same row , webgrid don't showing the values as the image number two inserted on this question and show empties input text on new editing as the image number three inserted on this question.
How to do resolve this?


