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

RadGrid.Rebind not refreshing data

7 Answers 622 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawna
Top achievements
Rank 1
Shawna asked on 17 Feb 2011, 07:14 PM

Hi.  I have a Radgrid with a MasterTableView and 2 Detail Tables (total of 3 levels).  I have each GridTableView set to

 

 

HierarchyLoadMode

 

="Client" and I am binding the tables in my code-behind.  I have an OnNeedDataSource method as well as an OnDetailTableDataBind method to do all the binding.  On the first page load, the grids/tables all bind correctly.  In the 3rd level detail table, I have a button that will call a server-side OnClick method that will remove that row from the data in the database.  I then want to refresh the entire RadGrid to show that the row was removed, which may affect the upper 2 levels if it was the last row removed.  So, at the end of the OnClick method in the code-behind, I try calling the Rebind() method on my RadGrid.  Both the OnNeedDataSource and the OnDetailTableBind methods get fired and my screen seems to refresh (meaning it blinks and goes back to its original state of only the first level grid is expanded), however the data is not freshed and when I expand to the 3rd leve, the row I just deleted is still showing.  When I refresh the browser, however, the data does refresh and the row is gone. 

Even though the HierarchyLoadMode is set to Client, meaning that the data is kept in viewstate, I thought that by calling the Rebind method it would reload the data to viewstate and to the screen.  Is that not correct?  It seems to call the same methods when I refresh the browser page as when I call the .Rebind() method.  What am I missing here?  

By the way, I've got the Q3 2010 version of the RadControls and I'm using I.E. 6  (sad as it is) for my browser.  I also have the ClientSettings for AllowExandCollapse = true (since the documentation I found said I should have that set when using HierarchyLoadMode of Client), however this doesn't seem to have any impact for my app. 

Thanks for any help,
Shawna

 

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 23 Feb 2011, 03:32 PM
Hello Shawna,

Unfortunately I'm unable to reproduce the problem. Please download the attached sample project and let me know if I'm leaving out something important.

Regards
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Shawna
Top achievements
Rank 1
answered on 25 Feb 2011, 05:17 PM
Hi Daniel,

Thank you for responding.  I'm trying to set up the sample you attached.  I started a new VS2008 project as a RadControl web app and plugged in your aspx page (Default3.aspx)  and the web.config included and put the SessionDataSource.cs in the App_Data folder.  What other steps do I need to take to use the sample with session data so I don't need to convert it to use SqlDataSource (as described in these instructions I found here: http://demos.telerik.com/aspnet-ajax/Common/QSFInstructions/Instructions.html ).  I currently have the Telerik trial version installed and I cannot find Telerik.Web.SessionDS.dll so the datasource declarations will resolve.

Thanks again for  your help,
Shawna
0
Daniel
Telerik team
answered on 25 Feb 2011, 05:33 PM
Hello Shawna,

You don't have to create a new project. Just extract the archive in a new folder, add Telerik assemblies (to the BIN folder) and then open the folder as a website.

Best regards,
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Shawna
Top achievements
Rank 1
answered on 25 Feb 2011, 05:51 PM
Hey Daniel,

Ok, I did this.  Now I expect that I have to set Default3.aspx as the start page, right?  After I did that, I get an error trying to open the Northwind database: " Cannot open database "Northwind" requested by the login. The login failed."  and it failed here:

 

protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)

 

 

{

 

 

DataTable queryTable = ((DataView) base.ExecuteSelect(arguments)).Table;

 


So next I need the Northwind database?

~Shawna
0
Daniel
Telerik team
answered on 28 Feb 2011, 08:48 AM
Hello Shawna,

It is not neccessary to set Default3.aspx as a start page. Just right-click on page and then select "View in browser"

Northwind is the most popular sample database. It is available for download from Microsoft Download Center:
Northwind and pubs Sample Databases for SQL ...

Regards,
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Shawna
Top achievements
Rank 1
answered on 02 Mar 2011, 11:10 PM
Hi Daniel,

Thanks for your help!  I got your sample running with the Northwind database.  There are a few things I'm doing different, for example, the updates to my database are done in a separate transaction (actually it's done in a WWF workflow) so my grid row deletes are not done directly on the page.  Instead, I popup a RadWindow that has a 'Submit' button on it.  When the user hits 'Submit', the code-behind in the button-click event fires an event into my workflow that will end up changing the database used to populate my datasource.  Then a new RadWindow pops on the screen up to tell the user that the transaction is done.  At this point, they have an 'OK' button whose click event does the RadGrid.Rebind and closes the popup.   This is when I wanted to grid to refresh.  I noticed you had a refresh button at the top of each of your grids so I tried just adding that to mine but it didn't help because my problem was somewhere else.  Also I wasn't sure exactly what that Refresh button actually does (I'll have to read up on it).

Turns out, my problem was that when I called the radgrid.Rebind method in the code-behind, the method that populated the datasource was not actually making a new trip to the database as I had thought.  Once I fixed that, the Rebind worked as I had expected.

I appreciate your sample though because being new to these controls, I did learn some things from what I saw in your sample, like the built-in buttons available in the grids.
Thanks again,
Shawna
0
Daniel
Telerik team
answered on 08 Mar 2011, 12:42 PM
Hello Shawna,

I'm glad to hear that the problem has been solved successfully. As to your question - the Refresh button rebinds RadGrid (as if you invoke RadGrid.Rebind).

Regards,
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Shawna
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Shawna
Top achievements
Rank 1
Share this question
or