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

[Solved] Using DomainDataSource with RadGridView

3 Answers 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
BlogReader
Top achievements
Rank 1
BlogReader asked on 05 Nov 2009, 11:38 AM
I am creating a DomainDataSource and binding its Data property to a RadGridView.ItemSource and of course it only gives me one page.

I dont want to use a DataPager control and instead I would like to use the ScrollBar to scroll through the data and once I hit a page boundary to load the next page.

I have worked over 30 hours on this so far and no luck.

Problems I ran into:

1. if the page size is smaller than the displayable area the scroll bar wont show up. What is the easiest way to make sure the scrollbar is always visible?
This is what I am doing now:

 

var scrollbars = _Grid.ChildrenOfType<ScrollBar>();
var verticalScrollBar = scrollbars.Where(bar => bar.Orientation == Orientation.Vertical).First();

 

verticalScrollbar

 

.Visibility = Visibility.Visible;

2. If I set the ScrollBar's Maximum property to the Size of the TotalNumber of records it doesn't seem to make any difference. The scrollbar is still almost as large as the viewing area: (TotalDataCount comes from the Loaded event e.TotalEntityCount)

 

 

 

var scrollbars = _Grid.ChildrenOfType<ScrollBar>();

 

var scrollBar = scrollbars.Where(bar => bar.Orientation == Orientation.Vertical).First();

scrollbar

 

.Maximum = TotalDataCount;

 

 

scrollbar.Minimum = 1;

 

scrollbar.SmallChange = 1;

 

scrollbar.Value = 1;

  

 

In my testcase I have 49 records and I set the PageSize to 20 and the LoadSize to 40. So the Minimum is 1 and the Maximum is 49 yet the scroll bar thumb still takes up to 98% (approx) of the scrollbar area.

3. How do I tell the DomainDataSource to go ahead and load the next page? I was using an Internal DataPager (Not displayed in the UI)
void verticalScrollBar_Scroll(object sender, ScrollEventArgs e)  

{

 

    if (DataPager.PageIndex != (int)e.NewValue)

 

    {

       DataPager.PageIndex = (int)e.NewValue;

    }

}

 

But once I did go the the next page it only showed 9 items and would not show the previous page. The DomainDataSource seems to think that that is the complete amount of data.

I really would like to do something simialr to the Telerik demo "Server page, sort and filter" and use a DomainDataSource and still use the built in scrollbar (I like the ScrollPositionIndicatorTemplate).

 

 

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Nov 2009, 11:40 AM
Hi,

You can use external scrollbar similar to this demo:
http://demos.telerik.com/silverlight/#GridView/Performance/ServerSide

Sincerely yours,
Vlad
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
BlogReader
Top achievements
Rank 1
answered on 05 Nov 2009, 11:43 AM
1. I said I didnt want to use an external scrollbar
2. I want to use a DomainDataSource since thats its purpose in life and it does more than the demo does.

I am asking specifically for a solution similar to that demo. The reason I cant use that demo is that it is not generic enough and doesn't handle all the cases I need like a DomainDataSource does.
0
Vlad
Telerik team
answered on 05 Nov 2009, 04:34 PM
Hi,

Since the grid internal scrollbar is not designed to work in such scenario your only option is external scrollbar. You do not need the other code - just the scrollbar!

Regards,
Vlad
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.
Tags
GridView
Asked by
BlogReader
Top achievements
Rank 1
Answers by
Vlad
Telerik team
BlogReader
Top achievements
Rank 1
Share this question
or