default selected index?

6 posts, 2 answers
  1. Kyle
    Kyle avatar
    2 posts
    Member since:
    Apr 2011

    Posted 13 May 2011 Link to this post

    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
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 16 May 2011 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 18 May 2011 Link to this post

    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.
  5. MARIANO
    MARIANO avatar
    9 posts
    Member since:
    Sep 2011

    Posted 11 Jun 2012 Link to this post

    its posible? to set currentrow=false in desing time and not fire event

    CurrentRowChanged

    thanks

  6. Answer
    Jack
    Admin
    Jack avatar
    2335 posts

    Posted 12 Jun 2012 Link to this post

    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 >>
  7. MARIANO
    MARIANO avatar
    9 posts
    Member since:
    Sep 2011

    Posted 12 Jun 2012 Link to this post

    thanks its a very good idea
Back to Top
UI for WinForms is Visual Studio 2017 Ready