The previous value of the column is 3000 then after I changed it to 3 then CellValueChanged is fired but then the string quantity does not return 3 but instead 3000. I will be using the new value to update the record on the database.
| private void radGridView1_CellValueChanged(object sender, Telerik.WinControls.UI.CurrentRowChangedEventArgs e) |
| { |
| String quantity = radGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(); |
| String dbidx = radGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); |
| String itemcode = radGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); |
| var query = (from p in db.TB_ITEMs |
| where p.ITEM_DBIDX == Convert.ToInt32(dbidx) |
| select p).Single(); |
| query.ITEM_DURABILITY = Convert.ToInt32(quantity); |
| if (!String.IsNullOrEmpty(itemcode)) |
| query.ITEM_IDX = Convert.ToInt32(itemcode); |
| db.SubmitChanges(); |
| } |
The datasource comes from a result of a LINQ query, I need to update at database level using this event. If I am not using the right event please direct me to the right event. This event fires up after editing the field and clicking outside the field BUT it does not return the new value but the old value. Please tell me if you need more information, this is kind of urgent.
After clicking outside the cell the value reverts to the old value hence the CellValueChanged event gets the old value. What should I do to commit the new value to the Grid Row and to retrieve the new value for database updating?
Language: C#
Telerik Version: 2010.1.10.308
.NET: 3.5
Need Help,
Aivan