This is a migrated thread and some comments may be shown as answers.

Event clarification

1 Answer 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Morgan
Top achievements
Rank 1
Morgan asked on 07 Jun 2011, 08:40 PM
Thanks in advance for any assistance.

What event would I use to grab the GridRowInfo when the navigates to a another row? I'm working with the RowsChanged event and it's firing after -each- change to the row when evaluating the NotifyCollectionChangedAction.ItemChanged enum.

Essentially, what I need to do, is if any value in the row changes, I need to get the row and update the database. If I use the RowsChanged event, I potentially would be updating the same record over and over if multiple values are changed for the same record.

Do I need to use a combination of events?
1. RowsChanged - store an instance of the GridViewRow to a local variable
 then
2. RowValidated - commit row information to database?

Is there a more direct way to do what I need to do?

Thanks,

Morgan


1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 10 Jun 2011, 11:07 AM
Hi Morgan,

You need to subscribe only to the CellValueChanged event, where you can perform the saving logic:

this.radGridView1.CellValueChanged += new GridViewCellEventHandler(radGridView1_CellValueChanged);


private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)
{
    GridViewDataRowInfo row = e.Row as GridViewDataRowInfo;
    GridViewDataColumn col = e.Column as GridViewDataColumn;
 
    // TO DO Your Save operation
}

I hope this helps.

Best wishes,
Svett
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Morgan
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or