William Davies
Top achievements
Rank 1
William Davies
asked on 01 Dec 2009, 09:59 AM
Hi all,
I've been stuck with this for some time now and am at my wits end to be honest. I'll try as best to describe the situation clearly.
I have a radgrid that's populated via pagemethods and ajax and all seems to work fine most of the time. I also use a treeview so that users can select various folders and upon clicking a foldername in the treeview, that in change re-populates the radgrid with items from that folder. This all works fine except for that when the radgrid is repopulated, I call another pagemethod that returns the count of items within the current datasource and updates the virtualcount of the radgrid. This works sporadically. As an example, if there are 4 folders to click on in the treeview, it will work when clicking on folder 2, not work on folder 3, work on folder 4, not work on folder 2 but then work again on folder 3? It's really strange. I've debugged as much as possible and the correct values are always returned by the pagemethid and set using the 'tableView.set_virtualItemCount(result);' function.
This is the update function that's called after every databind,
function updateVirtualItemCount(result) {
var tableView = $find("<%= gvWebcasts.ClientID %>").get_masterTableView();
tableView.set_virtualItemCount(result);
}
Is there any way to force a refresh of the paging items section of the radgrid? Any help HUGELY appreciated.
Regards,
William
I've been stuck with this for some time now and am at my wits end to be honest. I'll try as best to describe the situation clearly.
I have a radgrid that's populated via pagemethods and ajax and all seems to work fine most of the time. I also use a treeview so that users can select various folders and upon clicking a foldername in the treeview, that in change re-populates the radgrid with items from that folder. This all works fine except for that when the radgrid is repopulated, I call another pagemethod that returns the count of items within the current datasource and updates the virtualcount of the radgrid. This works sporadically. As an example, if there are 4 folders to click on in the treeview, it will work when clicking on folder 2, not work on folder 3, work on folder 4, not work on folder 2 but then work again on folder 3? It's really strange. I've debugged as much as possible and the correct values are always returned by the pagemethid and set using the 'tableView.set_virtualItemCount(result);' function.
This is the update function that's called after every databind,
function updateVirtualItemCount(result) {
var tableView = $find("<%= gvWebcasts.ClientID %>").get_masterTableView();
tableView.set_virtualItemCount(result);
}
Is there any way to force a refresh of the paging items section of the radgrid? Any help HUGELY appreciated.
Regards,
William
7 Answers, 1 is accepted
0
Hello William,
I suspect the problem is not in the "virtual item count" portion of your code but in the client data binding logic. Please, take a closer look at our online examples demonstrating the latter (here) and if the problem persists, I'd ask you to open up a formal support ticket and send you files so that we can review them and give you more concrete details on the issue.
Thanks.
Regards,
Tsvetoslav
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.
I suspect the problem is not in the "virtual item count" portion of your code but in the client data binding logic. Please, take a closer look at our online examples demonstrating the latter (here) and if the problem persists, I'd ask you to open up a formal support ticket and send you files so that we can review them and give you more concrete details on the issue.
Thanks.
Regards,
Tsvetoslav
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.
0
William Davies
Top achievements
Rank 1
answered on 04 Dec 2009, 08:52 AM
Hi
Tsvetoslav
Thanks for the prompt response. I managed to fix the problem with a bit of a hack, believe me, I tried everything. It works now and all I did was to set the virtualitemcount to 0 before each databind and the update it after the databind. Ugly but it works.
Thanks again,
William
Thanks for the prompt response. I managed to fix the problem with a bit of a hack, believe me, I tried everything. It works now and all I did was to set the virtualitemcount to 0 before each databind and the update it after the databind. Ugly but it works.
Thanks again,
William
0
Michael weinberger
Top achievements
Rank 1
answered on 05 Mar 2010, 07:46 PM
Hi Willian,
I am having the same problem as you, tried setting the VirtualCount to zero first but didnt help either.
This is the code I am using in JS.
And this the grid declaration:
Then in the PageLoad event in code behind I am just doing this to get the table populated the first time:
Dim list(4) As GridData
testGrid.DataSource = List
testGrid.DataBind()
The data just loads ok (5 rows are returned from the WS), but the count of items remains in zero.
Really stuck on this, any help will be appreciated, thanks
I am having the same problem as you, tried setting the VirtualCount to zero first but didnt help either.
This is the code I am using in JS.
| function TestGrid() |
| { |
| TestService.GetListGrid("test", TestGrid_Callback); |
| return false; |
| } |
| function TestGrid_Callback(result) |
| { |
| var grid = $find("<%= testGrid.ClientID %>"); |
| var tableView = grid.get_masterTableView(); |
| tableView.set_dataSource(result); |
| tableView.dataBind(); |
| tableView.set_virtualItemCount(1000); |
| } |
And this the grid declaration:
| <rad:RadGrid runat="server" ID="testGrid" AutoGenerateColumns="false"> |
| <MasterTableView name="master" TableLayout="Fixed" PagerStyle-Mode="NextPrevAndNumeric" PagerStyle-AlwaysVisible="true" AllowPaging="true" AllowCustomPaging = "true" PageSize="5"> |
| <Columns> |
| <rad:GridBoundColumn HeaderText="F1" DataField="F1"> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn HeaderText="F2" DataField="F2"> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn HeaderText="F3" DataField="F3"> |
| </rad:GridBoundColumn> |
| <rad:GridBoundColumn HeaderText="F4" DataField="F4"> |
| </rad:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </rad:RadGrid> |
Then in the PageLoad event in code behind I am just doing this to get the table populated the first time:
Dim list(4) As GridData
testGrid.DataSource = List
testGrid.DataBind()
The data just loads ok (5 rows are returned from the WS), but the count of items remains in zero.
Really stuck on this, any help will be appreciated, thanks
0
Michael weinberger
Top achievements
Rank 1
answered on 08 Mar 2010, 04:12 PM
Still not able to fix but I think I have found something.
If I inspect with Firebug the pager in the sample there are several spans (for the page number, total of pages, etc), but not in my version nor in the basic paging samples.
I debugged the code and the call to set_virtualItemCount fails because that spans are not available.
I tried removing the server side binding I am using but in that scenario the grid dont get rendered nor populated from client side, seems that I need to do at least an empty binding to get the grid accesible in client side.
How should I handle the load? In the sample you use a "PageLoad" JS function that does not work for me (it gets called, but throws an error when accesing the grid)
If I inspect with Firebug the pager in the sample there are several spans (for the page number, total of pages, etc), but not in my version nor in the basic paging samples.
I debugged the code and the call to set_virtualItemCount fails because that spans are not available.
I tried removing the server side binding I am using but in that scenario the grid dont get rendered nor populated from client side, seems that I need to do at least an empty binding to get the grid accesible in client side.
How should I handle the load? In the sample you use a "PageLoad" JS function that does not work for me (it gets called, but throws an error when accesing the grid)
0
Hi William,
Could you try leaving just the client-side binding (add a call to the web service in the client pageLoad event) and let me know of the result.
Thanks.
All the best,
Tsvetoslav
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.
Could you try leaving just the client-side binding (add a call to the web service in the client pageLoad event) and let me know of the result.
Thanks.
All the best,
Tsvetoslav
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
Michael weinberger
Top achievements
Rank 1
answered on 11 Mar 2010, 02:51 PM
Hi Tsvetosla,
I tried removing the Server Side binding (on Page_Load) and keeping only the client pageLoad call, but on the callback I cannot access the master table view.
In the second line get_masterTableView() returns null on the new version (from the last few days) on the previous one the error was "parameter cannot be null: parameter name Id"
I tried removing the Server Side binding (on Page_Load) and keeping only the client pageLoad call, but on the callback I cannot access the master table view.
| var grid = $find("<%= testGrid.ClientID %>"); |
| var tableView = grid.get_masterTableView(); |
In the second line get_masterTableView() returns null on the new version (from the last few days) on the previous one the error was "parameter cannot be null: parameter name Id"
0
Hi Michael,
I have attached a small sample demonstrating how to bind the grid on the client and handler the call-backs. If you continue to experience the same problem, I will ask you to open up a formal support ticket and send your files for debugging.
Thank you.
Regards,
Tsvetoslav
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.
I have attached a small sample demonstrating how to bind the grid on the client and handler the call-backs. If you continue to experience the same problem, I will ask you to open up a formal support ticket and send your files for debugging.
Thank you.
Regards,
Tsvetoslav
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.