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

Adding rows when GridView is filtered.

1 Answer 74 Views
This is a migrated thread and some comments may be shown as answers.
Thomas Van den Bossche
Top achievements
Rank 1
Thomas Van den Bossche asked on 04 Nov 2009, 10:26 AM
Dear Sir/Madam,

Is it possible to add rows when a filter is applied to the GridView?

1. I've added a filter programmatically
FilterExpression filterDriver = new FilterExpression(); 
             GridFilterCellElement.ParameterName ); 
filterDriver.Parameters.Add( GridFilterCellElement.ParameterName, varFilter ); 
gridAssigned.Columns[ COLUMN_DRIVER ].Filter = filterDriver; 

2. While this filter is active, I want to add a new row programmatically.
GridViewDataRowInfo newRow = gridAssigned.Rows.NewRow(); 
gridAssigned.Rows.Add( newRow ); 

But this doesn't work. I also added
gridAssigned.MasterGridViewTemplate.Update( GridUINotifyAction.RowsChanged ); 
but without success.

Thanks in advance!

1 Answer, 1 is accepted

Sort by
Julian Benkov
Telerik team
answered on 06 Nov 2009, 09:36 AM
Hi Thomas Van den Bossche,

You can add row/rows to RadGridView when a filter is applied. Newly added rows will be visible only when its data fill the filter criteria. We found some problems with NewRow() method when used in this scenario. The fix will be available for next our release. Currently you can use Add(params object[] values) in your situation:

this.radGridView1.Rows.Add("20", 30, "40");

All the best,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Asked by
Thomas Van den Bossche
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question