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

Programmatically Scrolling Grid Horizontally

1 Answer 103 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jorge Gonzalez
Top achievements
Rank 1
Jorge Gonzalez asked on 08 Feb 2010, 07:55 PM
Hello,
   I want to be able to type in a header caption name into a text field, which would cause the grid to horizontally scroll to the column containing the typed in name. Is there a simple way to do this? I cannot figure out how to make the grid move left or right.
I thought scrollintoview might be the way to go but I cannot get it to work. I wish the documentation from Telerik was better.
Thanks

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 09 Feb 2010, 08:07 AM
Hello Jorge Gonzalez,

You can use the ScrollIntoView method to scroll to a specific column. For example:

// find the right column
var targetColumn = (from GridViewColumn column in this.playersGrid.Columns
                   where column.Header.ToString() == "Name"
                   select column).FirstOrDefault();
  
// bring the column into view
this.playersGrid.ScrollIntoView(null, targetColumn);


All the best,
Milan
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
GridView
Asked by
Jorge Gonzalez
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or