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

Gridview Value Change

12 Answers 1564 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Manikandan
Top achievements
Rank 1
Manikandan asked on 10 Nov 2009, 02:43 AM
Hi I am using Q2 2009 radGridview with checkbox column. I need to do count the number of rows has been checked after eacg checkbox is checked. But the value changed event in the radgridview is not working properly. It's not returing the true value after the checkbox is checked in current row. If i check two checkboxes first time the selected checkbox doesn't  return true.When i select the second checkbox then it shows one row is checked that was previously checked .Pls tell me an appropriate event for the checkbox checked event in grid.Thanks for the help.

12 Answers, 1 is accepted

Sort by
0
John Husted
Top achievements
Rank 1
answered on 25 May 2010, 02:31 PM
You ever get this working?  I'm experiencing the exact same issue. . .
0
MP
Top achievements
Rank 1
answered on 26 May 2010, 05:16 PM
You have to use the CellValueChanged event instead of ValueChanged event.

Regards,
MP
0
Jack
Telerik team
answered on 27 May 2010, 04:31 PM
Hello guys,

MP, thank you for your reply.

John, the ValueChanged event is fired when an editor changes its value. When handling this event you should check ActiveEditor.Value to get the current value. If you want to track changes of the cell value, you have to handle CellValueChanged event, as MP replied. I hope this helps. If you have further questions, do not hesitate to contact us.

Kind regards,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Bill Battaglia
Top achievements
Rank 1
answered on 02 Jun 2010, 09:33 PM
I populated radGridView using herarical dataset and I edited the field in radGridView

and updated the database in this event "radGridPartsList_CellEndEdit". Now I want to refresh the grid automatically. After updating the record into the database I called BindDataGrid function which called "ResetGridView" and binded data source then instead of refreshing the grid it errors, looks like it enters into the recursion to bind the datagrid and then it errors. Which event I should use to Bind the grid which refreshes the grid after the cell is edited?

 

 

0
Jack
Telerik team
answered on 08 Jun 2010, 10:23 AM
Hello Bill Battaglia,

When using DataTable, DataSet or a BindingList and your business object implements INotifyPropertyChanged interface it is not necessary to do anything to update RadGridView. It will do this automatically. In all other cases you can call GridElement.Update or MasterGridViewTemplate.Update methods:
this.radGridView1.GridElement.Update(GridUINotifyAction.DataChanged);
// or (when the code above doesn't help)
this.radGridView1.MasterGridViewTemplate.Update(GridUINotifyAction.Reset);

Changing the data source in this situation is not recommended. If this does not help to resolve the issue, please send us your application and we will investigate it further.

I am looking forward to your project.

Sincerely yours,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Bill Battaglia
Top achievements
Rank 1
answered on 08 Jun 2010, 02:13 PM
Will give it a try.

Bill
0
Don
Top achievements
Rank 1
answered on 11 Aug 2010, 11:16 PM
I'm getting the same behavior using the 2010 Q2 control. I've tried the suggested fixes and all that happens is a blank row is added to the top of the grid. The row that was updated retains the old values in the grid even though the underlying data table was successfully updated.
0
Julian Benkov
Telerik team
answered on 17 Aug 2010, 10:29 AM
Hello Don,

Would you please provide a more detailed description of your scenario? What type of DataSource object do you use? Is it a DataTable, or a custom business object, or other type? Please send us code snippets which illustrate how you are updating your instance.

I  am looking forward to your reply.

Sincerely yours,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Don
Top achievements
Rank 1
answered on 17 Aug 2010, 02:52 PM
I'm using a DataTable as the DataSource of the grid. I have tried merging the changed row back into the original DataTable and the updating the grid using the code snippets you suggested and all that happens is a blank row gets added to the top of the grid. However, when I double-click on the changed row to bring up my detail form the changes are there.

Code to update the original DataTable with changed row:
arg = New PropertyCollection
arg.Add("@defseq", args("@defseq"))
 
updateRow = mDefDetail.Read(arg)
 
updateTable.ImportRow(updateRow)
 
Form1.dt.Merge(updateTable, False)
Form1.dt.AcceptChanges()
After this is when I tried your suggested methods for updating the grid. I know the data is getting updated because I have seen it when stepping through the code and watching the relevant variables.

The only way I've been able to get this to work is by basically setting the DataTable and DataSource values to Nothing and then rerunning the stored procedure to repopulate the DataTable and reset the DataSource to the very same DataTable again:
Form1.dt = Nothing
Form1.dt = Form1.myDatalayer.Rows("", Form1.spName, Form1.pArgs)
 
Form1.NewDoc.RadGridView1.DataSource = Nothing
Form1.NewDoc.RadGridView1.DataSource = Form1.dt
Form1.NewDoc.RadGridView1.Refresh()
This gives me the desired result of an updated grid with no additional blank rows at the top. If there is an easy way to update a cell value directly, that would probably work as well. I'm new to the Telerik tools, so I do not know all of the 'secrets', yet.
0
Julian Benkov
Telerik team
answered on 20 Aug 2010, 11:28 AM
Hello Don,

Thank you very much for the detailed information.

As I analyzed your code snippets, I noticed that you set a new instance to Form1.dt  (DataTable object):

Form1.dt = Nothing
Form1.dt = Form1.myDatalayer.Rows("", Form1.spName, Form1.pArgs)

In your scenario the RadGridView DataSource resetting is a required operation. Please use the following line:

Form1.NewDoc.RadGridView1.DataSource = Form1.dt

I hope this helps. Let me know if I can assist you further.

Best wishes,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Don
Top achievements
Rank 1
answered on 20 Aug 2010, 03:07 PM
I'm sorry, I should have been clearer. The original DataSource for my grid is Form1.dt. I empty the DataTable and refill it because simply updating the changed row does not get the grid to update even when I set the grid's DataSource to Nothing and then re-assign the updated Form1.dt as the grid's DataSource.

I'm already doing as you suggested (two rows below the snippet you took from my snippet) because it is the only thing I've found that works, but it is far from being an optimal solution. Imagine how long it would take to refill a DataTable that has 1,000,000 rows just to update a grid! An extreme example, to be sure, but it makes the point I'm trying to get across.

What I wish were available in the RadGridView is the ability to directly replace rows in the grid with DataRows, rather than having to cobble together an iterative loop to change the values of cells within the grid. I'm on a project now that will contain grids with child grids and I am really not looking forward to figuring out how to update a row in a child grid to show a change in a single column!
0
Julian Benkov
Telerik team
answered on 25 Aug 2010, 04:35 PM
Hello Don,

For 1,000,000 records the refill operation of the bound DataTable object and the corresponding RadGridView updates will take time close to the time taken when you reset the DataSource property.
These two operations call Reset updates in grid GridViewTemplate object. In order to have optimal performance you can use VirtualMode in this scenario, but this will stop all data operations (sorting, grouping, filtering) and you must make an external layer for this functionality.

In your case you can iterate over the DataRows and change their values -  the changes will automatically be reflected by the RadGridView, but you cannot change the instances of the DataRow objects bound to the grid control

The RadGridView control updates automatically when its bound DataSource object is updated thanks to the IBindingList and INotifyPropertyChanged interfaces - DataTable and DataRow implement these interfaces. For additional information about RadGridView binding, please refer to this article.

Best wishes,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Manikandan
Top achievements
Rank 1
Answers by
John Husted
Top achievements
Rank 1
MP
Top achievements
Rank 1
Jack
Telerik team
Bill Battaglia
Top achievements
Rank 1
Don
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or