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

[Solved] locking selection

3 Answers 154 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
reema
Top achievements
Rank 1
reema asked on 23 Feb 2009, 08:36 AM

hi to all,

 how to lock or freeze the selected row in data grid?

thanx in advance....

3 Answers, 1 is accepted

Sort by
0
Jordan
Telerik team
answered on 24 Feb 2009, 01:12 PM
Hello reema,

There is no API to lock selected item.
You can register for SelectionChanged event. On every change you should set the locked record.
Look at the following code:

public Page() 
  InitializeComponent(); 
 
  //Bind grid 
   
  //Set selected item 
  this.gridView.SelectedRecord = this.gridView.Records[0]; 
   
  //Register for selection changed 
  this.gridView.SelectionChanged += new EventHandler<SelectionChangeEventArgs>(gridView_SelectionChanged); 
 
void gridView_SelectionChanged(object sender, SelectionChangeEventArgs e) 
    if (this.gridView.SelectedRecords.Count == 1 && this.gridView.SelectedRecords[0] == this.gridView.Records[0]) 
    { 
        return
    } 
 
    if (this.gridView.SelectedRecords.Count > 0) 
    { 
        this.gridView.SelectedRecords.Clear(); 
    } 
 
    this.gridView.SelectedRecord = this.gridView.Records[0]; 



All the best,
Jordan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
reema
Top achievements
Rank 1
answered on 28 Feb 2009, 10:40 AM

thx alot Jordan..

and how to change background color for the selected row..
thanx again..
0
Rosi
Telerik team
answered on 03 Mar 2009, 09:34 AM
Hello Reema,


RadGridView has a property called RowAppearance that can be used to define a new style for GridViewRow but unfortunately it does not work in the current version of RadGridView. This issue will be resolved in the incoming Q1 2009 release.

We are sorry for the inconvenience that this causes to you.

Regards,
Rosi
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
reema
Top achievements
Rank 1
Answers by
Jordan
Telerik team
reema
Top achievements
Rank 1
Rosi
Telerik team
Share this question
or