Extjs浮点值在c#控制器中作为null传递

Extjs浮点值在c#控制器中作为null传递,c#,asp.net-mvc,floating-point,C#,Asp.net Mvc,Floating Point,我在extjs模型中有一个浮点值。出于某种原因,我输入并传递给c#控制器的任何值都始终为空。我检查了正在传递的json数据,可以看到传递的值 这是我的extjs模型 fields: [ { name: 'Id', type: 'int' }, { name: 'FloatValue', type: 'float' }, { name: 'RecId', type: 'int' }, { name: 'Valid', type: 'bool' } ] C# 传递

我在extjs模型中有一个浮点值。出于某种原因,我输入并传递给c#控制器的任何值都始终为空。我检查了正在传递的json数据,可以看到传递的值

这是我的extjs模型

fields: [
    { name: 'Id', type: 'int' },
    { name: 'FloatValue', type: 'float' },
    { name: 'RecId', type: 'int' },
    { name: 'Valid', type: 'bool' }
 ]
C#

传递给控制器的JsonObject

{ Id: 0, FloatValue: 0.1, RecId: 12, Valid: true }
在C#debug上,“FloatValue”的值始终为null

这里有什么我遗漏的吗

更新-

var employee = new Object();
employee.Id = 0;
employee.FloatValue = 0.1;
employee.RecId = 12;
employee.Valid = true;

Ext.Ajax.request({
        method: 'POST',
        scope: this,
        url: 'EmployeeController/UpdateRecord',
        headers: { 'Content-Type': 'application/json' },
        dataType: 'json',
        jsonData: { employeeRec: employee },
        success: function (Response) {},
        failure: function () {}
});
C#

公共静态EmployeeRecord更新记录(IList employeeRec)
{
//此处employeeRec.FloatValue为null,但其他属性具有其值。
}

此类行为可能在getter或setter中显示为错误。您可以为setter提供正确的值,但是如果setter设置得不好,或者getter之后得到的不是编写的内容,那么您可以很容易地看到null


最有可能的getter或setter根本无法完成它的工作。

您可以从等式中删除extjs。这几乎肯定是后端代码的问题。如果您查看浏览器的“网络”选项卡,发现有效负载发送正确,请关注C#谢谢Matt。我检查了请求负载并查看了数据。在c#上,除了FloatValue之外,所有其他数据都在那里。我必须以某种方式定义浮点值才能正确映射它吗?我很久没有使用ASP.NET MVC了,所以我不是最好的帮助者。但是,如果显示更多代码,您将获得更多帮助。
EmployeeRecord
如何使用?控制器是什么样子的?当然,马特,任何帮助都可以。请看我的更新。我已经包括了我正在做的事情
var employee = new Object();
employee.Id = 0;
employee.FloatValue = 0.1;
employee.RecId = 12;
employee.Valid = true;

Ext.Ajax.request({
        method: 'POST',
        scope: this,
        url: 'EmployeeController/UpdateRecord',
        headers: { 'Content-Type': 'application/json' },
        dataType: 'json',
        jsonData: { employeeRec: employee },
        success: function (Response) {},
        failure: function () {}
});
public static EmployeeRecord UpdateRecord(IList<EmployeeRecord> employeeRec)
    {
        //Here employeeRec.FloatValue is null but other property has their values.
    }