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

Choosing the "best" grid.

I''d appreciate some help choosing the best grid to use for part of an application I am developing. The user is provided with forms for many actual data entry tasks. These forms are typically tabbed dialog boxes with an assortment of controls. A grid is used mainly as a "browsing" aid: Users browse the grid, select the item they want to edit, and then navigate to the data entry form which is populated with the selected item. In this case, in-place editing in the grids is not required or even desired. In fact, we do not want the individual cells in the grid to show an edit cursor, as this would imply that editing is possible. Use of a "hyperlink" cell in a key field could be used to navigate to the data entry form (but, will this work with Windows Forms?) or the user could just double-click in the desired row. The grouping and summary features of the GridGroupingControl are very desirable, but will it support turning editing off entirely? We also like the support for child grids, although it may not be totally necessary. Finally, built-in support for printing the data in the grid is highly desirable. Thanks in advance. --Van Baker

6 Replies

AD Administrator Syncfusion Team October 11, 2004 03:38 PM UTC

If you need the grouping an dsummary support an dyour data is in some kind of DataTable or something, then GridGroupingGrid would be the grid of choice. You can turn off editing using the this.gridGroupingControl1.TableDescriptor.AllowEdit property.


VB vbaker October 11, 2004 05:54 PM UTC

OK. But TableControlCellDoubleClick does not seem to fire when a user clicks on one of the record cells. However, TableControlCurrentCellControlDoubleClick does fire. How do I get the proper values for row, col (adjusted for the headers, nesting level, etc.)in the TableControlCurrentCellControlDoubleClick handler? --Van Baker


AD Administrator Syncfusion Team October 11, 2004 06:10 PM UTC

Try
private void gridGroupingControl1_TableControlCurrentCellControlDoubleClick(object sender, GridTableControlControlEventArgs e)
{
	int row, col;
	Point pt = e.TableControl.PointToClient(Control.MousePosition);;
	if (e.TableControl.PointToRowCol(pt, out row, out col))
		e.TableControl.CurrentCell.AdjustRowColIfCoveredCell(ref row, ref col);
	tableCellStyle = e.TableControl.GetTableViewStyleInfo(row, col);
	contextElement =  tableCellStyle.TableCellIdentity.DisplayElement;
	Console.WriteLine(row.ToString() + "  " + col.ToString());
}


VB vbaker October 11, 2004 07:15 PM UTC

That''s almost exactly what I tried! Now, I think my understanding of the grid geometry is at fault. I wanted to use col to determine the column name of the cell that was clicked and the text value in that cell. So I tired this: string strColName = e.TableControl.TableDescriptor.Columns[col].Name; DataRowView dr = contextElement.GetData() as DataRowView; string strText = dr[strColName].ToString(); This returns the wrong column name and text (offset to the right by one or 2 places, depending on whether it''s a nested grid that was clicked in) What am I doing wrong? --Van Baker


AD Administrator Syncfusion Team October 11, 2004 10:05 PM UTC

If your goal is to get the Text or the Column.Name, you can get these from the tableCellStyle:
private void gridGroupingControl1_TableControlCurrentCellControlDoubleClick(object sender, GridTableControlControlEventArgs e)
{
	int row, col;
	Point pt = e.TableControl.PointToClient(Control.MousePosition);;
	if (e.TableControl.PointToRowCol(pt, out row, out col))
		e.TableControl.CurrentCell.AdjustRowColIfCoveredCell(ref row, ref col);
	tableCellStyle = e.TableControl.GetTableViewStyleInfo(row, col);
  		Console.WriteLine(tableCellStyle.Text +" " + tableCellStyle.TableCellIdentity.Column.Name);
}


VB vbaker October 12, 2004 07:58 AM UTC

That works perfectly! I was trying to get the column information from the TableDescriptor rather than from the TableCellIdentity. To be honest, I find these names a little confusing. This is an awesome product, but the learning curve seems pretty steep. Do you have any docs you''d suggest to help with naming conventions, object model, etc? Again, Thanks! --Van Baker

Loader.
Up arrow icon