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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataBound Grid and Row Headers

Thread ID:





18061 Aug 23,2004 08:09 PM UTC Aug 24,2004 01:30 PM UTC WinForms 2
Tags: GridControl
Peter Zaborski
Asked On August 23, 2004 08:09 PM UTC

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.

Administrator [Syncfusion]
Replied On August 23, 2004 09:26 PM UTC

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";

Peter Zaborski
Replied On August 24, 2004 01:30 PM UTC

Awesome Clay, thanks! Works great. -Peter


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

Live Chat Icon For mobile
Live Chat Icon