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

DataBound Grid and Row Headers

Hello, I would like to use a simple Databound grid with one tweak. FWIW, the grid will be read only (no user updates of grid data) and will use a DataTable as the DataSource. The tweak is that I would like the row headers to behave like column headers. Specifically, I want to: a) eliminate the current row indicator (the arrow head) b) place text in the row header cells, ideally by using column 0 of my DataTable c) preserve the ability to use row header cells to select an entire row (via the usual windows methods, click, ctrl-click, click and drag, etc.) I''ve tried to do this by hiding column 0 of the grid and assigning the column header style to column 1. This handles the text requirement but the row selection is missing. And in order to fix that I have to resort to handling mouse down and mouse move events. I am hopeful there is an easier way to get the results I want. Thank you for any help. -Peter PS - I posted this originally to the ASP version of the forum (had the lonk bookmarked) but saw no replies so I re-posted here. Soory if this causes duplication.

2 Replies

AD Administrator Syncfusion Team August 23, 2004 05:26 PM

Try hiding column 1 (grid.Model.Cols.Hidden[1] = true;) so it does not show up in the grid. Then handle the PrepareViewStyleInfo vent and set the e.Style for column zero. This should allow the selection behavior to work.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex == 0 && e.RowIndex > 0)
	{
		e.Style.Text = this.gridDataBoundGrid1[e.RowIndex, 1].Text;
		e.Style.CellType = "Header";
	}
}


PZ Peter Zaborski August 24, 2004 09:30 AM

Awesome Clay, thanks! Works great. -Peter

Loader.
Live Chat Icon For mobile
Up arrow icon