Hi all,
I have a ultragrid with 80+column, so I use the KeyDown function to make it able to move like excel with ArrowKey and also mouse. To convinient for modify, I would like to let them direct key in and modify then when move to next field and direct update the previous updated value into DB.
How can I grap which cell/field which been modified? Because I want to allow them to update field by mouse clicking to it and also keyboard arrowkey, so I wasnt sure which function is more suitable for this scenario.
Please guide.
Thank you very much!
If I understood you correctly then the UpdateMode property would be useful in your scenario. With the line of code pasted below, it will commit the changes to the data source when the user leaves a modified cell.
ultraGrid1.UpdateMode = UpdateMode.OnCellChange;
Hi Torrey,
Thanks for reply. The function you mention able to capture more than 1 field with the column name and also the value? because I need to capture the column name also the value for my update query, so only those field been modified will be updated.
I had done some research online, notice that most of them using AfterCellUpdate, will it suitable for my case? If possible, can you explain with example how does it work?
Thank you very much!~
Hi,
AfterCellUpdate fires after the user makes a change to a cell and the the grid commits those changes to the underlying data source. When the change is committed is determined by the UpdateMode property. Updates can also be triggered in code via the Update method of the row or the UpdateData method of the grid.
I'm having a hard time understanding your question, though. Can you explain in more detail exactly what you want to do?
I found the way for my problem. Thanks all.
Is solved now.
Thanks for all guidance ^^
Hi Mike,
I try to get the updated cell with AfterCellUpdate and assign it into variable as part of my update statement, but it execute the update until the application "no respone". Please point out my mistake for better improvement.
private void ugLisfOfVolMaint_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
{ // AfterCellUpdate gets fired after the cell's value has been changed in the UltraGrid.
const string METHOD_NAME = "mnuShowStructure_Click";
Cursor oldCursor = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
string strSQL, svolID = "", svolLine = "", srouteID = "",sheader ="", svalue ="";
try
{
svolID = ugLisfOfVolMaint.ActiveRow.Cells["vol_id"].Value.ToString();
svolLine = ugLisfOfVolMaint.ActiveRow.Cells["vol_line_id"].Value.ToString();
srouteID = ugLisfOfVolMaint.ActiveRow.Cells["Route_ID"].Value.ToString();
sheader = e.Cell.Column.ToString();
svalue = e.Cell.Value.ToString();
strSQL = "update ras_vol_wafer set " + sheader + " = '" + svalue + "', last_update = sysdate " +
" where vol_id = '" + svolID + "' and vol_line_id = '" + svolLine + "' and rrth_id = '" + srouteID + "' ";
MyDBConn.ExecuteNonQuery(ModGloVariable.RasmusConn, CommandType.Text, strSQL);
}
catch (Exception ex)
ModProc.ShowSysErrMsg(ex.Message, METHOD_NAME, CLASS_NAME);
finally
Cursor.Current = oldCursor;
UltraDataSource doesn't have any back end, it only exists in the client. So it does not track changes.
But I think I am probably not understanding your question. Leaving a cell in the grid will automatically write any changes to the data source. This depends on the UpdateMode property, but updating on a cell change is the default.
I don't think I understand your question or what you are trying to do.
Im using UltraWinDataSource