I have a foreign key field column that is returning a value of 0 to the controller for newly created rows. However, a null is correctly returned if I update existing rows. How can I get a null value to be returned for new rows?
Here is the column declaration:
col.Field("
TransferToBrokerageSubAccountId").ForeignKeyField("BrokerageSubAccountId").ForeignKeyValue("FullAccountName").DataSource(((IEnumerable<object>)ViewBag.SubAccounts)).HeaderText("Transfer To").Add();
I am using the grid in batch edit mode with the datasource configured as:
.Datasource(ds => ds.URL(@Url.Action("BatchDataSource", "AccountTransaction")).BatchURL(@Url.Action("BatchUpdate", "AccountTransaction")).Adaptor(AdaptorType.UrlAdaptor))
And the class that it is being put into is (with most fields omitted):
// class does not have any defined constructors
public class BrokerageAccountTransactionRow
{
#region Properties and Indexers
public decimal Amount { get; set; }
public int BrokerageSubAccountId { get; set; }
public int? TransferToBrokerageSubAccountId { get; set; } #endregion
}
Regards, Jeff