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

Radgridview record source replace.

3 Answers 76 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe Bohen
Top achievements
Rank 1
Joe Bohen asked on 24 Jan 2012, 12:06 PM

I have a Radgrid and Datapager which is bound as the code below, the item source is a linq to sql class, the class is queried and the results are converted into a pivot table and both the pager and grid’s source properties are set and the grid has Aggregate Results and sort descriptors added this works well. I have a refresh button on the page but I can’t work out how to clear the pager and grid when the user clicks the button. I have tried your sample code but get errors. Could you please advise on the correct method.

 

<telerik:RadGridView x:Name="AgedJobsListgrid" ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Black" ShowColumnFooters="True" IsScrolling="False" IsTabStop="False" RowIndicatorVisibility="Collapsed" VerticalAlignment="Stretch"  DataContext="{Binding ElementName=radDataPager}" RowHeight="35" FontSize="14"></telerik:RadGridView>

            <telerik:RadDataPager x:Name="radDataPager" telerik:StyleManager.Theme="Office_Black"

                         PageSize="10"

                         DisplayMode="All"

                         IsTotalItemCountFixed="True" Source="{Binding AgedListClass}"  DataContext="{Binding ElementName=AgedJobsListgrid}" />

 

       ‘code used to clear the pager and grid which fails when setting the itemsource to nothing.

radDataPager.Source = Nothing

AgedJobsListgrid.GroupDescriptors.Clear()

        AgedJobsListgrid.ItemsSource = Nothing

        AgedJobsListgrid.Columns.Clear()

        AgedJobsListgrid.AutoGenerateColumns = True

 

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 24 Jan 2012, 02:46 PM
Hello,

 To refresh the ItemsSource you could use the Rebind() method of the RadGridView. Does it work for you?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Joe Bohen
Top achievements
Rank 1
answered on 24 Jan 2012, 03:39 PM
Hi Didie,

Thanks for the reply, but unfortunatley i Get the error:

This row has been removed from a table and does not have any data.  BeginEdit() will allow creation of new data in this row.

I am rebuilding the data source (drlist) on a background thread before passing the data back to the grid and data pager from a delegate:

Dim

 

 

pagedSource = New QueryableCollectionView(drlist)

 

Dispatcher.BeginInvoke(

 

DispatcherPriority.Background, New DPDelegate(AddressOf UpdateDataPager), pagedSource)

 

Dispatcher.BeginInvoke(

 

DispatcherPriority.Background, New JLDelegate(AddressOf UpdateJobList), pagedSource)

Regards
Joe

 

0
Dimitrina
Telerik team
answered on 24 Jan 2012, 04:18 PM
Hello Joe,

 Just from the given code snippets we may not conclude what is wrong. Could you please prepare for us a small sample project to show us the problem?

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Joe Bohen
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Joe Bohen
Top achievements
Rank 1
Share this question
or