This question is locked. New answers and comments are not allowed.
I have a grid, and one of the columns is a percent value. In my view model, I am specifying that it should use my custom percent editor control:
And the Percent control looks like this:
This actually works just fine and I'm able to show the percent control and change values and save them just fine. However, the problem is when I don't have a value.
I was looking at the POST variables when I save changes to my grid and noticed that it only POSTs the "PercentObligation" field only if there is a value in there. If there is no value, then that field is never sent in the POST. I would expect it to post that field without a value, but it doesn't.
Since I am using MVC's built-in UpdateModel() method, it doesn't properly update my model since it didn't receive a new value for PercentObligation.
Is this a known bug?
[UIHint(
"Percent"
)]
public
decimal
? PercentObligation {
get
;
set
; }
And the Percent control looks like this:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<
Nullable
<double>>" %>
<%= Html.Telerik().PercentTextBox()
.Name(ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty))
.InputHtmlAttributes(new { style = "width:100%" })
.MaxValue(100)
.MinValue(0)
.DecimalDigits(4)
.Spinners(false)
.Value(Model)
%>
This actually works just fine and I'm able to show the percent control and change values and save them just fine. However, the problem is when I don't have a value.
I was looking at the POST variables when I save changes to my grid and noticed that it only POSTs the "PercentObligation" field only if there is a value in there. If there is no value, then that field is never sent in the POST. I would expect it to post that field without a value, but it doesn't.
Since I am using MVC's built-in UpdateModel() method, it doesn't properly update my model since it didn't receive a new value for PercentObligation.
Is this a known bug?