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

Unselect all rows/columns

4 Answers 522 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Deborah
Top achievements
Rank 1
Deborah asked on 25 Oct 2010, 09:19 PM
I have an editable grid where the first column is a combobox.

I am using gridView1.ClearSelection to clear any selection because the customer wants the grid to appear with no default selection.

However, the first cell of the first row is still selected.

I've tried everything I can think of, but nothing seems to be unselecting that first cell in the first row.

I attached a screen shot in case this is not clear.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Deborah
Top achievements
Rank 1
answered on 25 Oct 2010, 09:35 PM
After more searching and trial and error, I found it: Gridview1.CurrentRow = nothing.

So never mind.
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 25 Oct 2010, 09:41 PM
Hello Deborah,

You can use the following code, in the DataBindingComplete event:
void radGridView1_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
{
    this.radGridView1.ClearSelection();
    radGridView1.CurrentCell.IsSelected = false;
    radGridView1.CurrentRow = null;
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Deborah
Top achievements
Rank 1
answered on 25 Oct 2010, 09:43 PM
I actually only needed to set CurrentRow.

But thanks!
0
Emanuel Varga
Top achievements
Rank 1
answered on 25 Oct 2010, 09:47 PM
Hello again Deborah,

If the selection of the RadGridView is set to FullRowSelect, strange enough you have to also specify that:
radGridView1.CurrentCell.IsSelected = false;

If you don't do this, the first row will be selected.

Best Regards,
Emanuel Varga
Tags
GridView
Asked by
Deborah
Top achievements
Rank 1
Answers by
Deborah
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Share this question
or