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. Image for the cookie policy date

Navigation Control

Hi, I need to put up a navigation control for the gridcontrol i am using. I want to know which of the two navigation control would be better: 1) GridRecordNavigationControl 2) RecordNavigationControl. In my gridcontrol i am displaying the ro w numbers in reverse order. i.e. Row zero is at the bottom and row 1 at top of row zero. So i need to navigate the records in same order. Can you help?

3 Replies

AD Administrator Syncfusion Team December 20, 2004 07:55 AM UTC

One way you can do this is to use the GridDataBoundGrid in virtual mode, swapping the row indexes in QueryCellInfo to reverse the order. One thing that complicates this (probably triples the code) is if you want to support the dynamic splitting. This mens you have to subscribe and unsubscribe to the events, and do some object management that would not be required if you did not do dynamic splitting. Here is a rough sample showing how you might do this. http://64.78.18.34/Support/Forums/Uploads/GRecNav.zip


AD Administrator Syncfusion Team December 20, 2004 08:44 AM UTC

Hi, My requirement is different from this application. For my application Row zero is at the bottom and row 10 is at the top. So when i am at the bottommost row and i click of next arrow then i should move up one row i.e. to row zero. Moreover my gridcontrol is not databound. I can add or delete rows at run time, So i need to take that into account.


AD Administrator Syncfusion Team December 20, 2004 11:43 AM UTC

You can probably come close to what you need by handling an event on the embedded navbar.
	private void Form1_Load(object sender, System.EventArgs e)
	{
		this.gridRecordNavigationControl1.NavigationBar.ArrowButtonClicked += new Syncfusion.Windows.Forms.ArrowButtonEventHandler(NavigationBar_ArrowButtonClicked);
	}
	private void NavigationBar_ArrowButtonClicked(object sender, Syncfusion.Windows.Forms.ArrowButtonEventArgs e)
	{
		switch(e.Arrow)
		{
			case Syncfusion.Windows.Forms.ArrowType.Next:
				e.Cancel = true;
				this.gridControl1.CurrentCell.MoveUp();
			break;
			case Syncfusion.Windows.Forms.ArrowType.Previous:
				e.Cancel = true;
				this.gridControl1.CurrentCell.MoveDown();
				break;
			case Syncfusion.Windows.Forms.ArrowType.Last:
				e.Cancel = true;
				this.gridControl1.CurrentCell.MoveTo(1, this.gridControl1.CurrentCell.ColIndex);
				break;
			case Syncfusion.Windows.Forms.ArrowType.First:
				e.Cancel = true;
				this.gridControl1.CurrentCell.MoveTo(this.gridControl1.RowCount, this.gridControl1.CurrentCell.ColIndex);
				break;
		}
		foreach(Syncfusion.Windows.Forms.InternalButton but in this.gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Buttons)
		{
			if(but != null && but.ToString() != "AddNew")
			{
				but.Enabled = true;
			}
		}
		this.gridRecordNavigationControl1.NavigationBar.Invalidate();
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon