Hello,
I want to display C# DataTable Data on igGrid But not display plz any one can help
Code:
public JsonResult BindGridVirtualization() { MMDataModelDataContext _db = new MMDataModelDataContext(_getString.GetSQLString()); GridVirtualizationModel model = new GridVirtualizationModel(); this.InitializeGridVirtualization(model.GridVirtualization);
DataTable table = GetMealTable(); var value = from c in table.AsEnumerable().AsQueryable() select c; model.GridVirtualization.DataSource = value; return model.GridVirtualization.GetData(); }
private DataTable GetMealTable()
{
DataTable tbl = new DataTable();
foreach (string str in columns) { tbl.Columns.Add(str,typeof(string)); }
var value = from c in _db.GetTable<tblMeal>() //where Convert.ToDateTime(c.Date).ToString("dd/MM/yyyy").Contains(con) where c.Date.Contains(con) orderby c.Date ascending
select c;
DataRow tr = tbl.NewRow();
foreach (tblMeal ob in value)
{ tr = tbl.NewRow();
tr[ob.MemberNickName] = ob.Amount;
tr["Date"] = ob.Date;tbl.Rows.Add(tr);
}
return tbl;
Hello all,
You could find detailed information about Binding to DataTable in our official online documentation at:http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.2/CLR4.0/html/igGrid_Binding_to_DataTable.html
Or take a look at the online samples: DataTable Interactions.
Alex,
Can you describe the feature or provide a link to an example? I can't find anything in the website regarding FR13933 and the ability to bind to a DataTable would be very helpful.
Thanks,
Paul
This feature is already available in versions 12.2 and later. It is now officially supported.
When FR13933 will be released and where i can see a progress?Also, if using your json sample, if first row contain Null in any of column, grid is not rendering that column.Is this a bug?
Hello Alex,
Thanks for reply with attachment.
Problem solved and have another query for igGrid.
When i edit ,insert and delete operation in this dynamic column type grid UpdateUrl Controller Action Received List of Transaction wit Generic type as Json Data format and parsing some who and Insert,Update and Delete operation is success.
Code Line:
List<Transaction<dynamic>> transactions = m.LoadTransactions<dynamic>(HttpContext.Request.Form["ig_transactions"]);
But i want to receive List of model object.
If i create a grid with Model have fixed number of properties can get List Of model object that means Json Data parsing Automatically With model class Properties and Value get by property Name.
List<Transaction<Person>> transactions = m.LoadTransactions<dynamic>(HttpContext.Request.Form["ig_transactions"]);
Person Class Have Fixed Number properties.
But I create a class with dynamic properties.
public class PersonList : DynamicObject { // The inner dictionary. Dictionary<string, object> properties = new Dictionary<string, object>(); public object this[string key] { get { if (properties.ContainsKey(key)) { return properties[key]; } return null; } set { properties[key] = value; } } public int Count { get { return properties.Count; } } public override bool TryGetMember(GetMemberBinder binder, out object result) { string name = binder.Name; return properties.TryGetValue(name, out result); } public override bool TrySetMember(SetMemberBinder binder, object value) { properties[binder.Name] = value; return true; } }
List<Transaction<PersonList >> transactions = m.LoadTransactions<dynamic>(HttpContext.Request.Form["ig_transactions"]);
I can not get Data by class property name an error fached Null reference Exception.
Plz Help and reply.
Thank You