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

DataSource = DataTable - change of complete DataSource contents

2 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rene
Top achievements
Rank 1
Rene asked on 17 Nov 2008, 03:14 PM
Hi guys, I am quite new to the telerik controls so hopefully you can be a little patient with my first question. ;)

I have a RadGrid with a DataTable as its DataSource. I want to use extended filtering functions which I developed myself and just reset the DataSource to a completely new DataTable which I create with my custom filtering methods.
I bind the DataTable with the recommendation in one of the examples:
protected void PriceGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    { 
        DataTable dataSource = getGridData(); 
        Session["priceGridDataSource"] = dataSource; 
        PriceGrid.DataSource = dataSource
    } 

The Function getGridData returns a DataTable which it gets using a generated SQL Command to retrieve the data from a SQL server.

But calling .Rebind() after my DataSource has changed doesn't fire the NeedDataSource event and so the DataGrid doesn't get the updated DataTable as its source.
The Rebind-Call is from an ASP.NEt AJAX request using a button_click event which sets the custom filter and changes the SQL command.

Thank you very much for your help, yours Rene



2 Answers, 1 is accepted

Sort by
0
Rene
Top achievements
Rank 1
answered on 18 Nov 2008, 09:35 AM
Update on that:
I am shure now that the DataSource gets bound correctly to the grid! There is the correct amount of pages etc. displayed if look with the debugger at it. (also at a postback the correct number is displayed so I am shure there is no event that alters anything unexpected afterwards!)
But the visual representation at the browser doesn't get updated!

It only updates if I click on one of the pages. After I have done this the correct number of (filtered) rows is displayed.

Tried simple and advance data binding - it's always the same! Internally everything is ok but the changes are not displayed!

I really need some help on this issue!

thank you very much, yours Rene
0
Rene
Top achievements
Rank 1
answered on 18 Nov 2008, 11:35 AM
just found the solution - the Grid wasn't in an UpdatePanel and therefore didn't get updated by ASP.NET AJAX in the AJAX-"Postback" which set the new Filter!

so sorry guys for bothering you. ;)
Tags
Grid
Asked by
Rene
Top achievements
Rank 1
Answers by
Rene
Top achievements
Rank 1
Share this question
or