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

Grid Navigation Control

Hi Clay, In the grid navigation control i would like to display Row 1 : 400. Currently there is a lot of space between the record number and the total number of rows. Is there any way this space can be implemented. Thanks & Regards Vinay

1 Reply

AD Administrator Syncfusion Team June 6, 2005 06:44 AM

There is no simple event that allows you to control this text. It is being drawn in the GridRecordNavigationControl.NavigationBar.OnPaint method, so it is buried pretty deep to get at through virtual overrides. Probably the simplest way to handle this is to put your own lablel over the display area and just format set it to be what you want. You can keep it is sync using grid.RowEnter.

//set up the label
private Label myLabel;
private void Form1_Load(object sender, System.EventArgs e)
{
	myLabel = new Label();
	Rectangle rect = this.gridRecordNavigationControl1.NavigationBar.ClientRectangle;
	int width = this.gridRecordNavigationControl1.NavigationBar.ButtonBarChild.Bounds.Width;
	myLabel.Bounds = new Rectangle(rect.Left, rect.Top, width, rect.Height);
	myLabel.TextAlign = ContentAlignment.MiddleCenter;
	this.gridRecordNavigationControl1.NavigationBar.Controls.Add(myLabel);
	//..... continue on with the existing code...
}

//handler
private void gridDataBoundGrid1_RowEnter(object sender, GridRowEventArgs e)
{
	GridDataBoundGrid grid = sender as GridDataBoundGrid;
	if(this.myLabel != null && grid != null)
	{
		this.myLabel.Text = string.Format("{0} of {1}", grid.Binder.RowIndexToPosition(e.RowIndex), 		grid.Binder.RowIndexToPosition(grid.Model.RowCount));
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon