I'm using ASPxGridView PerformCallback method to pass javascript value to behind code, it works. But I need to cast or convert string array in type and bind into ASPxGridView. How can I do it?
protected void detailGrid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
{
Group [] data = (Group)e.Parameters.Split(';');
List<Group> l = new List<Group>();
for (int i = 0; i < data.Length; i++)
{
l.Add(data[i]);
}
XFGridView1.DataSource = data;
XFGridView1.DataBind();
}
LINQ works fine for "converting" or "selecting":
IEnumerable<Group> data = e.Parameters.Split(';').Select(p=>new Group(p));
//or
IEnumerable<Group> data = e.Parameters.Split(';').Select(p=>new Group{SomeProperty=p});
assuming your Group class has a constructor that takes the string value or some property you wish to populate, respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With