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

RadGridView update

13 Answers 903 Views
GridView
This is a migrated thread and some comments may be shown as answers.
jimit r
Top achievements
Rank 1
jimit r asked on 15 Apr 2010, 10:55 AM
Hi team,

My RadGridView's columns are bound to a List. Even after placing EXPLICIT  code to rebind the grid after a record in inserted, the record fails to show up 1 out of 10 times. 

After i go to another page and come back to my grid, the record is there! What should i do?

Regards,
Jimit

13 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 15 Apr 2010, 11:10 AM
Hi jimit r,

Open a separate support ticket and send us you sample project.

Best wishes,
Ross
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
Ujjwal Lahoti
Top achievements
Rank 1
answered on 03 May 2010, 10:25 PM
I am also having the same issue.

The data behind the Grid is updated, but the Grid doesn't refresh itself. Some relevant sections of the code are:

Grid Declaration:
       <telerik:RadGridView x:Name="RadGridView1" Grid.Row="2"
              ItemsSource="{Binding Source={StaticResource DataSource}, Path=pdpEditorSource}"
              AutoGenerateColumns="False" HorizontalAlignment="Center"
              CanUserFreezeColumns="False" ShowGroupPanel="False" IsFilteringAllowed="False" FrozenColumnCount="1"
              CanUserReorderColumns="False" EditTriggers="CellClick,F2">

Data Binding:
        <local:PDPEditorSampleData x:Key="DataSource"/>

PDPEditorSampleData:
    class PDPEditorSampleData
    {

         public PDPEditorSampleData()
           {
             pdpEditorSource = new ObservableCollection<PDPGridClass>();

             //Create place holders for 24 paths
             for (int i = 0; i < 24; i++)
             {
                 pdpEditorSource.Add(new PDPGridClass() { Path = true, Modulation = "Static" });
             }
           }

           public ObservableCollection<PDPGridClass> pdpEditorSource
           {
               get;
               set;
           }
    }

PDPGridClass has lots of elements which corresponds to individual columns in the Grid.



 



The code behind the class is updated based on another event. However the Grid doesn't update. And when I double click the cell to edit it, I see the correct value, and after that the correct value stays.

The column definition is:
                <telerik:GridViewDataColumn Width="110" DataMemberBinding="{Binding hstInitDist, Mode=TwoWay}">
                    <telerik:GridViewDataColumn.Header>
                        <TextBlock Text="Ds (m)" TextAlignment="Center" TextWrapping="Wrap"/>
                    </telerik:GridViewDataColumn.Header>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding hstInitDist}" Foreground="{Binding Path, Converter={StaticResource colorConverter}}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding hstInitDist, Mode=TwoWay}" Foreground="{Binding Path, Converter={StaticResource colorConverter}}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>

The current behavior of the Grid is unacceptable. If there is some function to call to update/Refresh the Grid it would be very helpful.


0
Vlad
Telerik team
answered on 04 May 2010, 06:36 AM
Hello,

Do you get different behavior with standard WPF DataGrid?

Kind regards,
Vlad
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
Ujjwal Lahoti
Top achievements
Rank 1
answered on 04 May 2010, 11:55 AM
I haven't tried the standard WPF DataGrid, however I was planning to go that direction.

However irrespective of how the standard WPF DataGrid performs, the current behavior is unacceptable. Is there a mechanism to trigger DataGrid refresh?

Also was the problem of the previous poster resolved, if yes what was the solution?
0
Vlad
Telerik team
answered on 04 May 2010, 12:03 PM
Hi,

The grid will not refresh itself automatically on property change (outside of the grid) since this will lead to serious performance problems.

Best wishes,
Vlad
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
Ujjwal Lahoti
Top achievements
Rank 1
answered on 04 May 2010, 12:07 PM
Is there a way, I can trigger the update/refresh of the Grid, when I want the Grid to update?
0
Vlad
Telerik team
answered on 04 May 2010, 12:14 PM
Hello,

You can call Rebind() to achieve this.

Regards,
Vlad
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
Ujjwal Lahoti
Top achievements
Rank 1
answered on 04 May 2010, 12:15 PM
Further for standard WPF DataGrid there is an option to refresh the Grid. Look here:
http://programmer.wrighton.org/2009/01/wpf-datagrid-items-refresh.html

The command is: Datagrid.Items.Refresh()

I couldn't find an equivalent to this command in Telerik DataGrid. I haven't tried the command, however this looks like to me, what I want to do.



0
Vlad
Telerik team
answered on 04 May 2010, 12:19 PM
Hello,

Indeed you can find the same method in RadGridView Items collection.

Regards,
Vlad
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
Ujjwal Lahoti
Top achievements
Rank 1
answered on 04 May 2010, 12:30 PM
Thanks for the reply.

However I can't find the "Refresh" function under the Items.

0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 04 May 2010, 12:32 PM
Another question while using the Rebind option, when I call the "RadGridView1.Rebind()", I get the error message "The calling thread cannot access this object because a different thread owns it."

I am posting an event, to the Window that contains the DataGrid, when the message with new value to a particular cell is received from another application. Can you help me with this?

0
Vlad
Telerik team
answered on 04 May 2010, 12:40 PM
Hello,

You can try to call the method using Dispatcher:

Dispatcher.BeginInvoke((Action)(() => { RadGridView1.Rebind(); }));

Greetings,
Vlad
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
Ujjwal Lahoti
Top achievements
Rank 1
answered on 04 May 2010, 01:18 PM
Thanks this addressed my problem.
Tags
GridView
Asked by
jimit r
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Ujjwal Lahoti
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or