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

New to Syncfusion and Essential Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

37235 Nov 17,2005 01:40 PM Nov 22,2005 03:09 AM Windows Forms 11
loading
Tags: GridControl
Michael Scott
Asked On November 17, 2005 01:40 PM

I have just joined a new team, and am just starting to use Syncfusion for the 1st time. I''ve been asked to create a grid with some unique qualities (see attachment for mock-up). 1. I need to have custom row / column headers that will contain either numbers or text. Each time the grid refreshes its data, I will need to redraw these row / column headers as well. The numbers will not necessarily be consecutive (1, 2,3, etc...). 2. I need to have both row / column totals at the bottom / far right of the grid that sum the entire row / column. I need to have them have the same look as the row / column totals, and be non-selectable 3. Whenever the row and column match (row 3, column 3), I need that cell to be a different color 4. I need to have the ability to make the cells "read only", in that the user cannot edit them. I have found the "read only" property in styles, but don''t understand what this flag does for the Header style (seems to do nothing) 5. I need to be notified when the user selects a cell, group of cells, entire row, or entire column - and need to know which were selected, as I need to perform a specific action, depending on the selection. SO far, I''ve created a grid, am populating it with fake data, and am currently working on populating it with real data, but desparately need to know how to deal with the five items above. Any suggestions? Michael Scott

ConfusionMatrix.zip

Michael Scott
Replied On November 17, 2005 01:42 PM

Sorry, I am using 2.0.5.14, by the way.

Administrator [Syncfusion]
Replied On November 17, 2005 01:57 PM

Where is the data coming from and what is the size of this grid? If it is a modest grid (maybe of order 100x100), I would suggest using a GridControl with FormulaCell to get the summations. If it is a lot of data, then using a GridGroupingControl is probably a better option. The answers to your questions depend upon your choice of grid.

Michael Scott
Replied On November 17, 2005 04:02 PM

Typically the grid will be anywhere from 1x1 to a 250x250 in size. However, 100,000 by 100,000 is possible (though highly unlikely). The most common use case will be no more than 25x25 though. Essentially, you could look at the columns representing products sold at a store, where the rows could represent certain price points. Each "cell" would be the number of products sold at a particular price point. The data is already housed in a table. I''ll be pulling out the information in that table to populate the grid eacy time that table is updated. I''ll probably calculate the totals while I build the structure for the grid, instead of using any formulas that SyncFusion will provide. I just need to make those cells LOOK like the Row/Column border. Does that help? Michael Scott

Michael Scott
Replied On November 17, 2005 05:41 PM

Another question : Is there a way to have a Row and Column TITLE above the grid itself? Not a big deal, as I could always place text above/to the side of the grid to do the same thing, but was just wondering.

Administrator [Syncfusion]
Replied On November 17, 2005 06:02 PM

There is no grid property for this. You can have a panel, dock a label at the top and put a title/caption there. Then add the grid to the panel and dock fill the grid.

Michael Scott
Replied On November 17, 2005 10:03 PM

Regarding my questions : 1. For the most part, I figured this out, as long as the headers are numeric. How can I populate the grid in 1 line - including headers. I don''t mind converting all data to strings if necessary to accomodate text headers, but the Populate method I''m using requires an integer array. Can I somehow use a string array? I''m currently using the following to populate my table - headers and all : gridControlConfMatrix.Model.PopulateValues( GridRangeInfo.Cells(0, 0, rows, cols), intArray); Does PopulateValues *have* to be an integer array? Or is there a better way to populate the row/column header? 2. I''ve dealt with row / column totals, but have 1 minor question. Is there a way to have the color be the same as the header row/column? I did set the row/col in question to the "Heading" style, but the color is white. 3. I''ve figured this one out. 4. I''ve figured this one out 5. I don''t see help for any MouseUp events. How can I determine which cells / rows / columns are selected? Michael

Administrator [Syncfusion]
Replied On November 18, 2005 05:01 AM

1) No The source does not have to be an integer array. "dataSource - A data source that implements the IList interface or is an Array." But if you use an array, it must have dimension 2.
private void Form1_Load(object sender, System.EventArgs e)
{
	string [,] data = new string[11,11];
	for(int i = 0; i <= 10; i++)
	{
		for(int j = 0; j <= 10; j++)
		{
			data[i, j] = string.Format("row{0} col{0}", i,j);
		}
	}
	this.gridControl1.PopulateValues(GridRangeInfo.Cells(0,0,gridControl1.RowCount,gridControl1.ColCount), 
		    data);
}
2) Try this.gridControl1.RowStyles[10].BaseStyle = "Column Header"; 5) Check out the Selections/CurrentCell section of our Grid KB. In particular, here is one link that explains how ro retrieve arbitary selections. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=280

Michael Scott
Replied On November 18, 2005 03:50 PM

Regarding your knowledgebase article reference. The example program works OK for entire rows/columns, but not for RangeType of "Cells". In addition, it doesn''t allow for non-contiguous selections. How can I select R2C2:R2C4, column 5, and row 7 at the same time?

Administrator [Syncfusion]
Replied On November 18, 2005 07:00 PM

You can always loop through the exact range of cells you want to populate and directly set the cellvalues. If you use code like grid[row,col].cellValue = someValue; this will trigger grid events and will be slow for larger number of cells. But you can also directly access the GridData object to avoid these events, an dthis will be quite quick. This is what the Populatevalues method does. Here are a couple of forum threads on this idea. http://www.syncfusion.com/Support/forums/message.aspx?MessageID=9447 http://www.syncfusion.com/Support/forums/message.aspx?MessageID=22472

Michael Scott
Replied On November 21, 2005 08:32 PM

The problem is in the sample code. For Cells, you are using Range, instead of Range1. Fixing that gets Cells to work correctly.

Administrator [Syncfusion]
Replied On November 22, 2005 03:09 AM

Thank you for reporting this problem. We will get it corrected.

CONFIRMATION

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.

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.

;