how do I define the date format in a dropdownedit. Getting the error: Uncaught TypeError: Cannot create property "currency" on string "
ate = DateTime.Now.ToString("dd/MM/yyyy"), Code ="Platina", Description ="platina 2", Group="ct02",Value= 20.42, Unit= "Percentagem", Day=false, Month=false, Year=true, Vat=false},
new BusinessConfiguration() {Id=7 , Date = DateTime.Now.ToString("dd/MM/yyyy"), Code ="Ouro", Description ="ouro grosso", Group="ct01",Value= 34.90, Unit= "Unidade", Day=false, Month=true, Year=false, Vat=false},
new BusinessConfiguration() {Id=8 , Date = DateTime.Now.ToString("dd/MM/yyyy"), Code ="Ouro", Description ="ouro fino", Group="ct01",Value= 34.32, Unit= "Euro", Day=false, Month=false, Year=true, Vat=false},
new BusinessConfiguration() {Id=9 , Date = DateTime.Now.ToString("dd/MM/yyyy"), Code ="Ouro", Description ="ouro grosso", Group="ct01",Value= 34.90, Unit= "Euro", Day=false, Month=true, Year=false, Vat=false},
new BusinessConfiguration() {Id=10, Date = DateTime.Now.ToString("dd/MM/yyyy"), Code ="Prata", Description ="Prata 950", Group="ct03",Value= 0.39, Unit= "Unidade", Day=true, Month=false, Year=false, Vat=true},
new BusinessConfiguration() {Id=11, Date = DateTime.Now.ToString("dd/MM/yyyy"), Code ="Prata", Description ="Prata 925", Group="ct03",Value= 0.37, Unit= "Euro", Day=true, Month=false, Year=false, Vat=false},
};
ViewBag.GridNegocios = Gridname(dataSource);
return View();
}
public HtmlString Gridname(List<BusinessConfiguration> dataSource)
{
object regex = new { required = true };
ViewBag.dropdown = DropDownData.GetAllRecords();
// DropDownConfiguration[]dropdown=new DropDownConfiguration[]
// {
// new DropDownConfiguration(){Value="one",Text="one"},
// new DropDownConfiguration(){Value="two",Text="one"},
// new DropDownConfiguration(){Value="three",Text="one"},
// new DropDownConfiguration(){Value="test",Text="test"},
// };
List<GridColumn> lstColumns = new List<GridColumn>()
{
new GridColumn() { Field="Id", HeaderText="Id", IsPrimaryKey=true, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Right, Visible=false},
new GridColumn() { Field="Date", HeaderText="Data", EditType="datepickeredit", Format ="yMd", ValidationRules=regex, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Right, Width="150"},
new GridColumn() { Field="Code", HeaderText="Código",ValidationRules=regex, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, Width="70"},
new GridColumn() { Field="Description", HeaderText="Descrição",ValidationRules=regex, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, Width="150"},
new GridColumn() { Field="Group", HeaderText="Grupo",ValidationRules=regex, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Left, Width="60"},
new GridColumn() { Field="Value", HeaderText="Valor", EditType = "numericedit", ValidationRules=regex, TextAlign = Syncfusion.EJ2.Grids.TextAlign.Right, Width="60"},
new GridColumn() { Field="Unit", HeaderText="Unidade",EditType="dropdownedit", Edit= (new { @params = new { value = "one", fields = new { text = "ShipName", value = "ShipName" }, dataSource = @ViewBag.dropdown } }), TextAlign = Syncfusion.EJ2.Grids.TextAlign.Right, Width="70"},
new GridColumn() { Field="Day", HeaderText="Dia", EditType="booleanedit", DisplayAsCheckBox=true, Width="50"},
new GridColumn() { Field="Month", HeaderText="Mês", EditType="booleanedit", DisplayAsCheckBox=true, Width="50"},
new GridColumn() { Field="Year", HeaderText="Ano", EditType="booleanedit", DisplayAsCheckBox=true, Width="50"},
new GridColumn() { Field="Vat", HeaderText="Iva", EditType="booleanedit", DisplayAsCheckBox=true, Width="50"},
};
Common.Toolbar bar = new Common.Toolbar()
{
Add = true,
Edit = true,
Delete = true,
Update = true,
Cancel = true,
ExcelExport = true,
Click = "toolbarClick",
};
Common.GridFactory builder = new Common.GridFactory()
{
ID = "negocios",
DataSource = dataSource,
AllowExportExcel = true,
AllowPagging = true,
AllowFiltering = true,
AllowSorting = true,
AllowGrouping = true,
PageSize = 5,
AllowEditing = true,
AllowAdding = true,
AllowDeleting = true,
ShowConfirmDialog = true,
ShowDeleteConfirmDialog = true,
Columns = lstColumns,
Toolbar = bar,
};
return builder.Render();
}
}