Record Customization Demo

This sample demonstrates multiple rows per record and image cells.

This is the image of the sample.

EmployeeView

When you load the form in the designer, you first need to add an OLEDB data source for Northwind.mdb and change the connection strings in Form1.


    		// Code to specify the Connection string.
    		this.oleDbConnection1.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FindFile("Northwind.MDB");

    		// Code to fill the dataset with the data. 
    		this.oleDbDataAdapter1.Fill(this.dataSet11);

    		// Property to set how the image is displayed.
    		this.gridGroupingControl1.Appearance.AnyCell.ImageSizeMode = GridImageSizeMode.CenterImage;

    		// Code to show how to set text in "RecordPreviewCell " by subscribing to the QueryCellStyleInfo.
    		private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
    		{
    			switch (e.TableCellIdentity.TableCellType)
    			{
    				case GridTableCellType.RecordPreviewCell:
    				{
    					GridGroupingControl groupingControl = (GridGroupingControl) sender;
    					GridTable table = groupingControl.Table;
    					GridRecord record = (GridRecord) e.TableCellIdentity.DisplayElement.ParentRecord;
    					e.Style.CellValue = record.GetValue("Notes").ToString();
    					break;
    				}
    			}
    			StringBuilder sb = new StringBuilder();
    			sb.Append(e.TableCellIdentity.Info);
    			if (e.Style != null)
    			{
    				sb.AppendFormat("\r\nCellType = {0}", e.Style.CellType);
    				sb.AppendFormat(", CellValueType = {0}", e.Style.CellValueType);
    				sb.AppendFormat(", nFormat = \"{0}\"", e.Style.Format);
    				sb.AppendFormat(", CellValue = \"{0}\"", e.Style.CellValue);
    				sb.AppendFormat(", ImageSizeMode = \"{0}\"", e.Style.ImageSizeMode);
    				//sb.AppendFormat("\r\nStyle = {0}", e.Style.ToString("d"));
    			}
    			e.Style.CellTipText = sb.ToString();
    		}