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

Creating my own cell errors

I’m trying to simulate behavior when a cell is in error. I need my grid grouping control to show a particular cell(which I determine) is in error by displaying the red exclamation image in the cell and setting the tool tip of the cell to a customized error of my choosing.

I’m able to determine the record in error and the column where the error occurred from my dataset. (There may be multiple error within a record).

Within an initialization method I made, I tried to set the tool tip within a cell by using:

this.ggcErr.Table.GetTableCellStyle(record_item, “Column name”).CellTipText = “Error message”;

This does not set the tool tip for that cell.

Next I tried to use this:

gsi = (GridStyleInfo)this.ggcErr.Table.GetTableCellStyle((record_item, “Column name”));

gsi.CellTipText = “Error message”;

This also does not work;


Is there any way for me to set a cell of my choosing to indicate an error and set a customized tool tip for that cell?

I ‘m trying not to use QueryCellStyleInfo, it gets called too many times the cumpuation on every cell will be too costly. I do not need to check every cell within the grid too see if they are in error, my dataset has the exact items which are in error.

4 Replies

HA haneefm Syncfusion Team April 26, 2007 07:57 PM UTC

Hi Rocko,

Here is a forum thread that discuss with the simillar issue.
http://www.syncfusion.com/support/Forums/message.aspx?&MessageID=56452

Best regards,
Haneef


RT Rocky Tatlay April 27, 2007 02:11 AM UTC

Hi Haneef,

The examples are very close to what I need, except for a few differences.

I’m designing a grid which contains invoices that need editing in particular cells.

I want to mark every cell that needs editing when I initialize the grid. These cells will have the red exclamation mark and the cell tip. I load the data set with the exact columns within the records where the edit is required.

The examples given all use a user generated event to kick off the customized validation. The approach I’m taking is I initialize the grid and go through each record in the grid to determine where the edit is required and set the error and cell message. There will be multiple cells that will be marked this way.

The gridGroupingControl1_TableControlCurrentCellValidating() isn’t useful for me at this point because the user is not invoilved during the initalization, the cells in question are predetermined, im just trying to mark each of them. Is there a way to do this without using user events?

In a nutshell, im trying to do this:


foreach (Record record_err in this.ggcInvErr.Table.Records){

//Logic to find exact record and column that needs editing
//Now that I know the column and record how do I mark this cell and set cell tip on grid?
}
What do I do to record_err to achieve this?


RT Rocky Tatlay April 27, 2007 08:49 PM UTC

Just wondering if there is any update yet, thanks.


HA haneefm Syncfusion Team April 27, 2007 10:04 PM UTC

Hi Rocko,

If you want to draw the Exclamation mark on invalid cell, you need to handle the TableControlDrawCell event of the grid and draw image using the Graphics.DrawImage method. Here is a code snippet.

private void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
if( style != null
&& style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record
&& e.Inner.Style.Tag != null
&& style.TableCellIdentity.Column != null
&& style.TableCellIdentity.Column.Name == "OtherInfo" )
{
e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,e.Inner.Style);
Rectangle rect =new Rectangle( new Point(e.Inner.Bounds.Right - 20,e.Inner.Bounds.Top ),new Size(20,e.Inner.Bounds.Height));
e.Inner.Graphics.DrawImage(RedExclamation ,(RectangleF)rect);
}
}

Please refer to modifed sample for more details.
ErrorIconGGCValidIBindingList.zip

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon