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

gridview.selectedItem is null

1 Answer 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
igal a
Top achievements
Rank 1
igal a asked on 26 Aug 2010, 09:33 AM
i have this grid

 

 

<telerik:RadGridView x:Name="grid" ItemsSource="{Binding Path(ns:class.property)}"

 

 

 

SelectionMode="Single"

 

 

 

ShowGroupPanel="False" AutoGenerateColumns="False" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False"

 

 

 

RowIndicatorVisibility="Collapsed" Controls:StyleManager.Theme="Office_Black" EnableColumnVirtualization="False" EnableRowVirtualization="False" IsFilteringAllowed="False" Controls:RadControl.Theme="Office_Black" ReorderColumnsMode="None"
/>

now when i try to change selected item from code like this:

grid.SelectedItem = Collection[0];

the grid.SelectedItem stays null
even though Collection[0] is not null

i tried to call OnApplyTemplate before assignment but it didn't helped

i tried to do it with two way data binding and it didn't helped too

what can cause this?
and how can i solve it?

thanks

 

 

1 Answer, 1 is accepted

Sort by
0
igal a
Top achievements
Rank 1
answered on 26 Aug 2010, 03:02 PM
i solved it,
it was because the gridview wasn't loaded yet,

so i moved the init to the event handler of the RadGridView.Loaded event
and it worked
Tags
GridView
Asked by
igal a
Top achievements
Rank 1
Answers by
igal a
Top achievements
Rank 1
Share this question
or