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

default selected index?

5 Answers 133 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 13 May 2011, 03:46 PM
My gridview automatically expands a group when accessed that is in the middle of the grid so it forces the user to collapse the group and then scroll to the top of the grid. When I ungroup the data, the grid will just select a row. I basically need nothing to be expanded or selected by default but I do not see (or can not find) any options or documentation on solving this.


Edit: So it seems that it is selecting the first row from my database if this helps any.

Thanks,
Kyle

5 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 May 2011, 09:43 AM
Hi Kyle,

You can ensure that no rows are selected when the RadGridView loads by setting the following:
radGridView1.CurrentRow = null;

Hope that helps but let me know if you need more info.
Richard
0
Jack
Telerik team
answered on 18 May 2011, 08:46 AM
Hello Kyle,

Thank you for contacting us. When initialized with a data source RadGridView synchronizes its current position with the corresponding currency manager. In your case the selected row is inside a group and RadGridView automatically expands this group. You cannot change this behavior, however you can reset the current row and scroll to top programmaticaly.  Please consider the code below:

this.radGridView1.CurrentRow = null;
this.radGridView1.TableElement.VScrollBar.Value = 0;

I hope this helps.
 
Best wishes,
Jack
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
0
MARIANO
Top achievements
Rank 1
answered on 11 Jun 2012, 07:39 PM
its posible? to set currentrow=false in desing time and not fire event

CurrentRowChanged

thanks

0
Accepted
Jack
Telerik team
answered on 12 Jun 2012, 11:32 AM
Hello Mariano,

The CurrentRow property is not available at design time and therefore you can change it only with code. You can prevent the CurrentRowChanged event from firing by calling the SuspendEvent method of the EventDispatcher. Please consider the code below:
radGridView1.MasterTemplate.EventDispatcher.SuspendEvent(EventDispatcher.CurrentRowChanged);
radGridView1.DataSource = t1;
radGridView1.MasterTemplate.EventDispatcher.ResumeEvent(EventDispatcher.CurrentRowChanged);

I hope this helps.
 
Kind regards,
Jack
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
MARIANO
Top achievements
Rank 1
answered on 12 Jun 2012, 03:50 PM
thanks its a very good idea
Tags
GridView
Asked by
Kyle
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Jack
Telerik team
MARIANO
Top achievements
Rank 1
Share this question
or