I'm following your demo called Grid Heirachy with Templates. It shows a list of sales people and if you click the left column down arrow, it displays 3 tabs (sales, contact info, chart), each tab is designed with a RadPageView. It does work. However, the problem I have is when you load the page it executes the all queries to the database for each tab for every visible employee in the grid, all on page load. So if I have 50 rows in the main grid and 3 tabs (with scrolling enalbed naturally), 150 queries get executed all at once. This can be very bad for performance especially if I increase the rows on the main grid to a much higher number (which is what I need to do). I plan to show about 100 rows of data, plus add a few more tabs totaling 5 tabs of information, so I'd have 500 queries execute all on page load! on every postback too!
Not only is this a performance issue, it's also a stale data issue. If it's a highly active database with lots of inserts/updates going on, a grid user might wait 20 minutes, click the down arrow and see the orders with out-of-date information since a person somewhere else in the company might have since edited many rows of that order data for that sales person.
The solution is: Those 3 sub tabs should only execute their queries when the user clicks the down arrow to make them visible, per employee. How can that be accomplished?
Thank you.
Not only is this a performance issue, it's also a stale data issue. If it's a highly active database with lots of inserts/updates going on, a grid user might wait 20 minutes, click the down arrow and see the orders with out-of-date information since a person somewhere else in the company might have since edited many rows of that order data for that sales person.
The solution is: Those 3 sub tabs should only execute their queries when the user clicks the down arrow to make them visible, per employee. How can that be accomplished?
Thank you.
6 Answers, 1 is accepted
0

Jayesh Goyani
Top achievements
Rank 2
answered on 18 Nov 2011, 02:24 PM
Hello David,
Try with Below code snippet.
or
Thanks,
Jayesh Goyani
Try with Below code snippet.
<
MasterTableView
HierarchyLoadMode
=
"ServerOnDemand"
>
or
<
MasterTableView
HierarchyLoadMode
=
"ServerBind"
>
Thanks,
Jayesh Goyani
0

David
Top achievements
Rank 1
answered on 23 Nov 2011, 01:19 AM
Yes, I thought ServerOnDemand would make sense, but these settings have no effect. Each time you page through data, all of the sub tabs execute all of their queries for every single row in the grid, immediately.
The other problem is when you expand a sales person to see their 3 tabs (RadGrid1_ItemCommand fires), the tabs do not bind (they were already bound on page load). So the data you see is old. But this is the moment when they should ideally be binding. Not when the page first loads.
I'm working with the identical code in the online demo, I've made no modficiations to it.
Help?
The other problem is when you expand a sales person to see their 3 tabs (RadGrid1_ItemCommand fires), the tabs do not bind (they were already bound on page load). So the data you see is old. But this is the moment when they should ideally be binding. Not when the page first loads.
I'm working with the identical code in the online demo, I've made no modficiations to it.
Help?
0

Jayesh Goyani
Top achievements
Rank 2
answered on 23 Nov 2011, 10:15 AM
Hello,
First issue.
Can you please provide your code or submit a project using Support Ticket?
Second Issue.
Please try to set the Data of Tab in ItemDataBound or ItemCommand event inplace of page_load.
Let me know if any concern.
Thanks,
Jayesh Goyani
First issue.
Can you please provide your code or submit a project using Support Ticket?
Second Issue.
Please try to set the Data of Tab in ItemDataBound or ItemCommand event inplace of page_load.
Let me know if any concern.
Thanks,
Jayesh Goyani
0

David
Top achievements
Rank 1
answered on 03 Dec 2011, 12:03 AM
Hello Jayesh, thank you for taking the time to try and help with this. You asked:
"Can you please provide your code".
But this is not my code, I'm working directly with the Telerik code example. I've made absolutely no modifications to their code. I'm following the telerik demo called Grid Heirachy with Templates. I copied their code into Visual Studio and hit Start.
I use SQL Profiler to monitor calls to the database, that tool captures all the calls being made and when. That is how I know that the telerik demo code is making all of the db calls when the page first loads. Not when it should be made, (when a user clicks a down arrow to expand the 3 sub tabs).
They have no special code in page_load so I don't know how to stop the unnecessary db select calls.
I am also unsure how to move the proper calls into ItemCommand or ItemDataBound.
"Can you please provide your code".
But this is not my code, I'm working directly with the Telerik code example. I've made absolutely no modifications to their code. I'm following the telerik demo called Grid Heirachy with Templates. I copied their code into Visual Studio and hit Start.
I use SQL Profiler to monitor calls to the database, that tool captures all the calls being made and when. That is how I know that the telerik demo code is making all of the db calls when the page first loads. Not when it should be made, (when a user clicks a down arrow to expand the 3 sub tabs).
They have no special code in page_load so I don't know how to stop the unnecessary db select calls.
I am also unsure how to move the proper calls into ItemCommand or ItemDataBound.
0

Jayesh Goyani
Top achievements
Rank 2
answered on 03 Dec 2011, 03:40 PM
Hello,
try with below code snippet. (I am not sure its work or not because i have no sql profiler so....)
Let me know if any concern.
Thanks,
Jayesh Goyani
try with below code snippet. (I am not sure its work or not because i have no sql profiler so....)
protected
void
RadGrid1_DetailTableDataBind(
object
sender, GridDetailTableDataBindEventArgs e)
{
if
(!IsPostBack)
{
e.Canceled =
true
;
}
}
Let me know if any concern.
Thanks,
Jayesh Goyani
0

David
Top achievements
Rank 1
answered on 07 Dec 2011, 09:26 PM
I have solved both of my problems. For those interested:
Problem #1 - How to prevent the sub tabs from executing the queries on page load.
Answer: Intercept the Selecting event on each of the datasources you have, and cancel it during page load.
Problem #2 - How to then make each of the datasources rebind when the user expands a sales person by clicking the little down arrow.
Answer: Add this code to your main RadGrid's ItemCommand event. In my example I am rebinding 3 tabs of information:
Problem #1 - How to prevent the sub tabs from executing the queries on page load.
Answer: Intercept the Selecting event on each of the datasources you have, and cancel it during page load.
protected
void
sqlds_DeveloperInfo_Selecting(
object
sender, SqlDataSourceSelectingEventArgs e)
{
if
(!Page.IsPostBack)
{
e.Cancel =
true
;
}
}
Problem #2 - How to then make each of the datasources rebind when the user expands a sales person by clicking the little down arrow.
Answer: Add this code to your main RadGrid's ItemCommand event. In my example I am rebinding 3 tabs of information:
protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item
is
GridDataItem)
{
((GridDataItem)e.Item).ChildItem.FindControl(
"InnerContainer"
).Visible =
!e.Item.Expanded;
}
//if ExpandCollapse command is fired and the item is not expanded yet
//(meaning the item will expand after the command)
if
(e.CommandName == RadGrid.ExpandCollapseCommandName && !e.Item.Expanded)
{
//find inner RadGrid and rebind explicitly
RadGrid innerGrid = (e.Item
as
GridDataItem).ChildItem.FindControl(
"PTOGrid"
)
as
RadGrid;
innerGrid.Rebind();
RadGrid innerGrid2 = (e.Item
as
GridDataItem).ChildItem.FindControl(
"RadGridAssignments"
)
as
RadGrid;
innerGrid2.Rebind();
DetailsView detailsView = (e.Item
as
GridDataItem).ChildItem.FindControl(
"DetailsView_DeveloperInfo"
)
as
DetailsView;
detailsView.DataBind();
}
}