Dear support,
I really cannot find how to insert something to gridcontrol. Here are some incomplete code. In short, pe (the linq to entity) run the sql and use the result as the datasource of a gridcontrol. I allow the user to add new row to this gridcontrol
The question is. 1. i can see the new row at bottom. But when i input the text in 1 cell, and move to another cell, the text i type before is cleared. 2. if i use my own sql to insert the data back to db. what event in the gridcontrol will fire so that i can put my insert code.
// a long long SQL
string sql2 = @"SELECT v.VndrID AS [VendorNo] , v.Cmpny AS [CompanyName] , vp.PdtID AS [MaterialNo] , vp.PdtDscp AS [MaterialDescription] , p.ColorID AS [ColorNumber] , p.ColorNm AS [ColorName] , vp.LeadTime AS [LeadTimeDays] , vp.CostRate AS [Cost]FROM PdtColorVndr p LEFT JOIN Vndr v ON p.slkVndr = v.prmykey LEFT JOIN VndrPdt vp ON vp.prmykey = p.slkVndrPdtWHERE p.prntkey = @colorkeyORDER BY v.VndrID";
// set parameter
var sql2Params = new SqlParameter[] { new SqlParameter("colorkey", row.prmykey) };
// set it to gridcontrol data source
gridControl1.DataSource = pe.ExecuteStoreQuery<PdtColorVendor>(sql2, sql2Params);
Finally, I purchased DX perience 12.1. I cannot find it in your product list. But i think it is related to xtragrid suite
Posting multiple questions within a report makes it difficult to properly track and process such items.
In order to better serve you and track multiple questions in your inquiry, we have taken the liberty of separating the issues you addressed. For quick and efficient responses to your concerns, we kindly request that future inquiries address one issue at a time. Your time and cooperation are appreciated.
Please refer to this report for further correspondence on this item.
Hi Hak,
Thank you for contacting us. Our GridControl uses the same mechanism as the standard DataGridView to bind data. Try to bind your data source to the standard DataGridView control. If you have the same result, this means that your data source is not valid. In fact, our GridControl has one main requirement: your datasource must support the IList, IListSource, ITypedList, or IBindingList interface.
If you wish, we can research your application in greater detail. Just send us a simple example that illustrates your approach.
The most appropriate way to update your data is to use the GridView.RowUpdated event.
If you need additional assistance, feel free to reactivate this topic.
Thank you for your answer. ExecuteStoreQuery return ObjectResult<SomeClass>. ObjectResult is implementing ITypedList. As a result, the return value of ExecuteStoreQuery can be used a data source of GridControl. I make a very very simple application to show my problem. You cannot directly run as you dont have the database. You can add your own database and change the form a little bit. My form just have 2 lines of code and define a class to hold the result