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

unable to set selected row in gridview

1 Answer 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sandhya Pochiraju
Top achievements
Rank 1
Sandhya Pochiraju asked on 26 Jan 2010, 02:37 PM
hi all,
i hv a refresh button and i want to set first row or previously selected row as selected row after user refreshes the grid.
in the below code, _selectRow is of object type.  i am using customobjects in the project so _selectRow will be custom object of type "sample". however, i am unable to set selectedrow using the below code, please let me know if iam missing anything here.

regards,
Sandy



 

if (wipGridView.SelectedItem != null)

 

_selectedRow = wipGridView.SelectedItem ;

 

else

 

{

_selectedRow = wipGridView.Items[0] ;

}

 

this.Cursor = Cursors.Wait;

 

LoadWipGrid(_selectedDisplayType);

wipGridView.CurrentItem = _selectedRow;

wipGridView.SelectedItem = _selectedRow;

wipGridView.SetIsCurrent(_selectedRow,

true);

 

wipGridView.SetIsSelected(_selectedRow,

true);

 

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 26 Jan 2010, 03:03 PM

Hi Sandhya Pochiraju,

May I ask you to share more information about the refresh process (LoadWipGrid)? Is the data recreated or is the grid simply rebound?  The code looks correct, apart from the last two lines involving SetIsCurrent and SetIsSelected which are redundant.

If you could send us your application we will be able to determine the problem in a very short time.

Sincerely yours,
Milan
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
Sandhya Pochiraju
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or