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

Selected item in code behind

1 Answer 137 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 24 Jun 2010, 08:48 AM
I have a problem with selected item on the grid from code behind using GridViewSelectColumn. I have this code:
private void SelectElement(string element) 
        { 
            for (int i = 0; i < rg.Items.Count; i++) 
            { 
                if (((WSIS.WSInSEAAtrTElementListy)rg.Items[i]).Atc_Id.ToString() == element) 
                { 
                    rg.SelectedItems.Add(rg.Items[i]); 
                    break; 
                } 
            } 
        } 

It isn't working. Could you have some ideas?

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 24 Jun 2010, 03:38 PM
Hi Marcin,

Are you executing this code right after ItemsSource has been set? If that is the case I would kindly ask you to move the selection logic to the DataLoaded event. Currently the selection mechanism cannot be invoked before RadGridView is shown for the first time. We have already fixed this limitation for Q2.


All the best,
Milan
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
Tags
GridView
Asked by
Marcin
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or