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

Cannot bind to grid after updating recordset

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kelvin
Top achievements
Rank 1
Kelvin asked on 22 Oct 2008, 08:02 PM

Hi,

I am having problems using the RadGrid for asp.net Ajax.  I have a dataset.datatable that I put in session and bind to the grid.  That works without a problem.  But, when I intiate an Ajax Request (or Postback) to delete one of the records, I delete the record from the DB, and then delete the record from the table in session.  All of this works fine and you can see that the record is removed from the session table.  But, if I attempt to .databind() or .rebind() to the grid it does not display the records in the dataset it should be bound to.  It displays the 'No Records' default.  Again, immediately before .databind I can look at the table I am binding the grid to and see that it has the correct records.  Any thoughts?

Dim ds As DataSet = MySession.SearchResults
Me.RadGrid.DataSource = ds.Tables(1)
Me.RadGrid.Rebind()

FYI I also tried the .DataBind() with the same results.

 

Thanks!

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 27 Oct 2008, 07:26 AM
Hello Kelvin,

Resetting the datasource of the control like this is not a recommended approach (setting the DataSource directly, outside NeedDataSource). One possible option in this case would be use NeedDataSource event handler, and simply call the Rebind() method for the grid- this will in turn raise the NeedDataSource handler, and give you a chance to update the datasource.
Additionally, you can test to see if the AjaxSettings are properly included, and if the all initiators and updated controls are properly set.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Kelvin
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or