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.

GGC 7.403.0.20 - How to get correct instance of GridTableCellStyleInfo?

Thread ID:

Created:

Updated:

Platform:

Replies:

93844 Apr 7,2010 12:41 PM Apr 9,2010 05:35 AM Windows Forms 3
loading
Tags: Grouping
Bina Thakkar
Asked On April 7, 2010 12:41 PM

Event gridGroupingControl_TableControlPrepareViewStyleInfo sets cell style tag to "Error". Function IsErrorInSpreadsheet() wants to access style tag "Error" but GridTableCellStyleInfo is never set to "Error". How can I get correct instance of GridTablecellStyleInfo with "Error"?

=======
Code -

private bool IsErrorInSpreadsheet()
{
GridTableCellStyleInfo serialStyle = gridGroupingControl.Table.GetTableCellStyle(record, "column1");

string serialStyleTag = serialStyle.Tag as string;

// Want to access syle tag in following fucntion
// This never has "Error" tag
if (!string.IsNullOrEmpty(serialStyleTag) && serialStyleTag.Equals("Error"))
{
return true;
}

return false;
}



// Function sets style tag as Error
private void gridGroupingControl_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;

if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && e.Inner.ColIndex == 1)
{
Record record = style.TableCellIdentity.DisplayElement.ParentRecord;
string col1= record.GetValue("column1").ToString();
if (col1.Equals("0"))
{
style.CellTipText = "Invalid column1";
style.Tag = "Error";
}
else
{
style.Tag = "";
}
}
}



Thank you,
Bina Thakkar

Jisha Joy [Syncfusion]
Replied On April 8, 2010 05:01 AM

Hi Bina Thakkar,

Thank you for using Syncfusion products.

You need to handle QueryCellStyleInfo event, instead of TableControlPrepareViewStyleInfo to set the tag for the cells. See the code:

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Style;

if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && e.TableCellIdentity.ColIndex == 1)
{
Record record = style.TableCellIdentity.DisplayElement.ParentRecord;
string col1 = record.GetValue("column1").ToString();
if (col1.Equals("0"))
{
style.CellTipText = "Invalid column1";
style.Tag = "Error";
}
else
{
style.Tag = "";
}
}
}

Regards,

Jisha

Bina Thakkar
Replied On April 8, 2010 01:42 PM

Thank you - it worked

Jisha Joy [Syncfusion]
Replied On April 9, 2010 05:35 AM



Thank you for your update.


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.

;