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.

Formatting in QueryValue event

Thread ID:

Created:

Updated:

Platform:

Replies:

57790 Mar 12,2007 12:35 AM Mar 20,2007 05:27 PM Windows Forms 3
loading
Tags: GridControl
Anand
Asked On March 12, 2007 12:35 AM

Hi,
We are using Syncfusion Essential Studio 4.4.0.55 (GridGroupingControl).
I need to show the text in cell as red depending on the values in other cells of that row. I will get this values in QueryValue event only and formatting of cells can be done in QueryCellStyleInfo event. Could you please help me in setting the formatting on cells in QueryValue.
Also i need to change the header text in ExtraSection(custom headers) in QueryValue.

Administrator [Syncfusion]
Replied On March 12, 2007 04:58 PM

Hi Anand,

The QueryValue event is occured when the value for the unbound field descriptor or records are return. If you want to format the cell, you need to handle the QueryCellStyleInfo event of the grid and set the Style.Format to required format in a grid. Here is a code snippet

private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record
&& e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.Name == "ImgChk")
{
e.Style.CellValueType = typeof(int);
e.Style.CellValue = 76000;
e.Style.Format = "C";
e.Handled = true;
}
}

Also refer the TextFormat browser sample for more details.
\Syncfusion\Essential Studio\4.4.0.49\windows\Grid.Windows\Samples\Appearance\TextFormat\cs

Best regards,
Haneef

Administrator [Syncfusion]
Replied On March 20, 2007 03:42 AM

Hi Haneef,
How can I get the value of the cell which is getting painted and other cells as well for the same row in QueryCellStyleInfo so that I can decide what formatting has to be applied to the text of the painting cell.
Please help. Many Thanks in advance.

Administrator [Syncfusion]
Replied On March 20, 2007 05:27 PM

Hi Anand,

You can use the Record.GetValue method to get the value of the cells in a grid. Here is a code snippet

private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
Element el = e.TableCellIdentity.DisplayElement;
if(el.Kind == DisplayElementKind.Record )
{
GridRecordRow row = el as GridRecordRow ;
if( row != null && row.ParentRecord != null)
{
object obj = row.ParentRecord.GetValue("Col3");
Console.WriteLine(obj);
}
}
}

Best regards,
Haneef

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.

;