I have 2 grids that work correcly, but one of the parameters used to get the data of the child grid is a date with a format that varies when using different web browsers.
When the controller action recieves the date, the string has different values according to the browser used. For example:
-IE: "Mon Oct 17 00:00:00 UTC-0300 2016"
-Chrome: "Mon Oct 17 2016 00:00:00 GMT-0300 (Hora estándar de Argentina)"
-Firefox: "Mon Oct 17 2016 00:00:00 GMT-0300"
I'd like to know if I can format the date before sending it to the controller.
This are my grids:
PARENT GRID:
@(Html.Kendo().Grid(Model)
.Name("ParentGrid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Read", "controller")
.Data("ParameterFunction"))
.PageSize(30)
)
.Columns(columns =>
{
columns.Bound(foo => foo.fecha_venc).Title(Global.Fecha).Format("{0:dd/MM/yyyy}"); //This is the date I need formatted
columns.Bound(foo => foo.espe_codigo).Title(Global.Especie);
columns.Bound(foo => foo.clas_codigo).Title(Global.Clase);
})
.ClientDetailTemplateId("template")
)
CHILD GRID:
@(Html.Kendo().Grid<SGMTrade.DAL.ViewModels.OperacionesOCTPorFecha>()
.Name("ChildGrid")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(read => read.Action("childGrid_Read", "controller", new { fecha = "#=fecha_venc#", especie = "#=espe_codigo#", cliente = @ViewBag.cliente, clase = "#=clas_codigo#" }))
)
.Columns(columns =>
{
columns.Bound(o => o.oper_numero).Title(Global.NumeroOperacion)
.ClientTemplate("<a href='\\\\\\#' onclick=\"showDetails('\\#=oper_numero\\#')\">\\#=oper_numero\\#</a>");
columns.Bound(o => o.oper_forigen).Title(Global.FechaOrigen).Format("{0:dd/MM/yyyy}");
columns.Bound(o => o.espe_codigo).Title(Global.Especie);
columns.Bound(o => o.clas_codigo).Title(Global.Clase);
})
.ToClientTemplate()
)
CONTROLLER ACTION:
public ActionResult childGrid_Read([DataSourceRequest]DataSourceRequest request, string fecha, string especie, string cliente, string clase)
{
//the string fecha comes with the wrong formatting, and I need it to come as dd/MM/yyyy
}
Thank you very much