@grid
<ej-grid id="FlatGrid" allow-paging="true" >
. . .
<e-columns>
. . .
<e-column field="val" header-text="val" width=@("80px")></e-column>
</e-columns>
</ej-grid>
@server side
public IActionResult Index()
{
DataManagerConverter.Serializer = new DMSerial();
. . .
return View();
}
public class DMSerial : IDataSourceSerializer
{
public string Serialize(object obj)
{
var str = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
return str;
}
}
@enum declaration
public enum weekdays {
[EnumMember(Value="Monday")]
Monday,
[EnumMember(Value = "Tuesday")]
Tuesday,
[EnumMember(Value = "Wednesday")]
Wednesday,
[EnumMember(Value = "Thursday")]
Thursday,
[EnumMember(Value = "Friday")]
Friday,
[EnumMember(Value = "Saturday")]
Saturday,
[EnumMember(Value = "Sunday")]
Sunday,
}
@List
public void BindDataSource()
{
int code = 10000;
for (int i = 1; i < 10; i++)
{
order.Add(new Orders(code + 1, "ALFKI", i + 0, 2.3 * i, new DateTime(1991, 05, 15), "Berlin", weekdays.Monday));
order.Add(new Orders(code + 2, "ANATR", i + 2, 3.3 * i, new DateTime(1990, 04, 04), "Madrid",weekdays.Thursday));
order.Add(new Orders(code + 3, "ANTON", i + 1, 4.3 * i, new DateTime(1957, 11, 30), "Cholchester",weekdays.Tuesday));
order.Add(new Orders(code + 4, "BLONP", i + 3, 5.3 * i, new DateTime(1930, 10, 22), "Marseille",weekdays.Friday));
order.Add(new Orders(code + 5, "BOLID", i + 4, 6.3 * i, new DateTime(1953, 02, 18), "Tsawassen",weekdays.Sunday));
code += 5;
}
} |
public enum weekdays {
[Display(Name ="Monday")]
Monday,
[Display(Name = "Tuesday")]
Tuesday,
…
} |
public enum weekdays {
[EnumMember(Value = "This is Monday")]
Monday,
[EnumMember(Value = "This is Tuesday")]
Tuesday,
[EnumMember(Value = "This is Wednesday")]
Wednesday,
[EnumMember(Value = "This is Thursday")]
Thursday,
[EnumMember(Value = "This is Friday")]
Friday,
[EnumMember(Value = "This is Saturday")]
Saturday,
[EnumMember(Value = "This is Sunday")]
Sunday,
} |