We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

force a scroll to row

Thread ID:





38558 Dec 14,2005 11:43 PM UTC Dec 15,2005 11:23 PM UTC WinForms 9
Tags: GridControl
Eric Weber
Asked On December 14, 2005 11:43 PM UTC

I''m using a GGC. After I add an object to the arraylist that the control is bound to, I then want the grid to scroll to the row that was just inserted. How do I do this? thanks!

Administrator [Syncfusion]
Replied On December 15, 2005 01:14 AM UTC

Get the index of the new object in the ArrayList (it is returned by the ArrayList.Add call). Then try code like: grid.Table.Records[index].SetCurrent();

Eric Weber
Replied On December 15, 2005 02:18 PM UTC

Is your assumption that the newly added array list object will appear at the bottom of the grid? In our case, this isn''t necessarily true due to the grid being sorted. This might be a better question... How do I force a grid (GGC) to scroll to the currently selected row (a row that I''ve programmatically selected)? thanks!

Administrator [Syncfusion]
Replied On December 15, 2005 04:27 PM UTC

>>currently selected row (a row that I''''ve programmatically selected)? I am not sure what this means? (There might be many selected records in a grid). Can you show me the code you use programmatically set the record current? The reason I ask is that if you know the GridRecord object, then you can just call gridRecord.SetCurrent() to scroll record visible (and make it current).

Eric Weber
Replied On December 15, 2005 06:07 PM UTC

Here you go...... public void AddTraderComment(object sender, EventArgs e) { TraderComment tc = new TraderComment(); int index = sci.TraderComments.Add(tc); //clear all selected records in grid grid.TableControl.Table.SelectedRecords.Clear(); //select the new row that was just added foreach(Record record in grid.TableControl.Table.Records) { TraderComment tc2 = (TraderComment)record.GetRecord().GetData(); if(tc2.Id == tc.Id) { grid.TableControl.Table.SelectedRecords.Add(record); } } //now I need to force scroll to the newly added, newly selected row }

Eric Weber
Replied On December 15, 2005 06:11 PM UTC

adding... Record.SetCurrnt() right after... grid.TableControl.Table.SelectedRecords.Add(record) didn''t work

Administrator [Syncfusion]
Replied On December 15, 2005 07:07 PM UTC

I think calling record.SetCurrent should work. When you tried that, were any excpetions shown in your output window? What kind of thing is sci.TraderComments? Does it implement IBindingList?

Eric Weber
Replied On December 15, 2005 09:24 PM UTC

sci.TraderComments is an instance of TraderCommentList. This is what the grid is bound to. TraderCommentList inherits from BaseBindingList. BaseBindingList inherits from CollectionBase and implements IBindingList. public class TraderCommentList : BaseBindingList public abstract class BaseBindingList : CollectionBase, IBindingList Is there an IBindingList property that I need to set?

Eric Weber
Replied On December 15, 2005 09:27 PM UTC

forgot to mention......no errors in output window

Administrator [Syncfusion]
Replied On December 15, 2005 11:23 PM UTC

Here is sample that uses an ArrayList of objects. It has a button click event that alternately adds or inserts a new item in the ArrayList and making the newly inserted or added item current. http://www.syncfusion.com/Support/user/uploads/GGC_Copy_9bf3b3e.zip In this sample, calling record.SetCurrent is all that is required. I am using version 4.1. Does this work for you? Can you tell us how to see teh problem in this sample?


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon