This question is locked. New answers and comments are not allowed.
                        
                        Hi... I have an ajax grid as follows :
With this ViewModel:
And this action in my controller:
As you can see, I'm defining a [Remote] validator for field "Importe" that will pass an AdditionalField called "Propuesto", both present at model and grid. The problem is that even when the controller's action is called for validation, "Propuesto" always comes as null.
If I define it as "decimal" at my action... I get a 500 server error, then I changed it for "string" and I saw that the problem is that "Propuesto" always comes as null.
Then checking the HTML at edit time, I saw that the .ReadOnly column for "Propuesto" is rendering its value as plain text, so I thought the problem was that I needed to make propuesto editable (not what I need but okay for testing purposes). So I removed the .ReadOnly attribute from "Propuesto"'s column, but the result is the same: "Propuesto" always comes null to the validation action.
I also tried to change the [Remote]'s HttpMethod to POST, and the result is the same... in fact, when I check "Request.Form" at my action, only "Importe" comes in the collection.
Can you fix that or teach me a workaround, please?
Cheers
                                @(Html.Telerik().Grid<TraspasoViewModel.TraspasoAlbaranesCandidatosVM>()                 .Name("GridCandidatos")                 .DataKeys(k => k.Add(o => o.IdCentroServicio))                 .DataBinding(db => db.Ajax().Select<TraspasoController>(o => o._obtenerGridCandidatos())                                             .Update<TraspasoController>(o => o._updateGridCandidatos(0))                                             .Delete<TraspasoController>(o => o._deleteGridCandidatos(0)))                 .Sortable()                 .Filterable()                 .Reorderable(cf => cf.Columns(true))                 .Resizable(cf => cf.Columns(true))                 .Scrollable(sc => sc.Height(450))                 .Pageable(pg => pg.PageSize(50))                 .Selectable()                 .Columns(cl =>                 {                     cl.Command(cm =>                     {                         cm.Edit().ButtonType(GridButtonType.Image);                         cm.Delete().ButtonType(GridButtonType.Image);                     }).Width(80).Title("Acciones");                     cl.Bound(o => o.Empresa).ReadOnly().Width(90);                     cl.Bound(o => o.Tercero).ReadOnly().Width(90);                     cl.Bound(o => o.NomLocal).ReadOnly().Width(250);                     cl.Bound(o => o.NomTitular).ReadOnly().Width(250);                     cl.Bound(o => o.Modelo).ReadOnly().Width(100);                     cl.Bound(o => o.NumeroSerie).ReadOnly().Width(100);                     cl.Bound(o => o.Propuesto).ReadOnly().Width(100).HtmlAttributes(new { style = "text-align:right" });                     cl.Bound(o => o.Importe).HtmlAttributes(new { style = "text-align:right" });                 }))With this ViewModel:
public class TraspasoAlbaranesCandidatosVM : EntidadVM       {           public long IdCentroServicio { get; set; }           public string Codigo { get; set; }           public string Nombre { get; set; }           public long IdEmpresa { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_Empresa")]           public string Empresa { get; set; }           public string NomEmpresa { get; set; }           public long IdLocal { get; set; }           public string Local { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_NomLocal")]           public string NomLocal { get; set; }           public long IdTercero { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_Tercero")]           public string Tercero { get; set; }           public string NomTercero { get; set; }           public long IdMaquina { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_Modelo")]           public string Modelo { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_NumeroSerie")]           public string NumeroSerie { get; set; }           public long IdTitular { get; set; }           public string Titular { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_NomTitular")]           public string NomTitular { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_Importe")]           [Remote("_comprobarImporte", "Traspaso", "Recaudacion", AdditionalFields = "Propuesto", ErrorMessageResourceType = typeof (TraspasoStrings), ErrorMessageResourceName = "TraspasoAlbaranesCandidatosVM_Importe_El_importe_no_puede_superar_la_cantidad_propuesta_")]           public decimal Importe { get; set; }           [Display(ResourceType = typeof(TraspasoStrings), Name = @"TraspasoAlbaranesCandidatosVM_Propuesto")]           public decimal Propuesto { get; set; }           public TraspasoAlbaranesCandidatosVM() : this(new TraspasoAlbaranesCandidatosGrid()) {}           public TraspasoAlbaranesCandidatosVM(TraspasoAlbaranesCandidatosGrid entidad): base(entidad)           {               this.Propuesto = entidad.Importe;           }       }And this action in my controller:
public ActionResult _comprobarImporte(decimal Importe, decimal Propuesto)        {            return Json((Propuesto < 0)                            ? (Importe >= Propuesto)                            : (Propuesto >= Importe), JsonRequestBehavior.AllowGet);        } As you can see, I'm defining a [Remote] validator for field "Importe" that will pass an AdditionalField called "Propuesto", both present at model and grid. The problem is that even when the controller's action is called for validation, "Propuesto" always comes as null.
If I define it as "decimal" at my action... I get a 500 server error, then I changed it for "string" and I saw that the problem is that "Propuesto" always comes as null.
Then checking the HTML at edit time, I saw that the .ReadOnly column for "Propuesto" is rendering its value as plain text, so I thought the problem was that I needed to make propuesto editable (not what I need but okay for testing purposes). So I removed the .ReadOnly attribute from "Propuesto"'s column, but the result is the same: "Propuesto" always comes null to the validation action.
I also tried to change the [Remote]'s HttpMethod to POST, and the result is the same... in fact, when I check "Request.Form" at my action, only "Importe" comes in the collection.
Can you fix that or teach me a workaround, please?
Cheers

