How can I get the display text of a particular GridGroupingControl cell? The Record.GetValue(...).ToString() statement does not nesessarily give the display text. For example, the actual text displayed in the cell that holds the DateTime value is "7/8/1996 8:00 AM", while Record.GetValue(...).ToString() returns "7/8/1996 8:00:00 AM" (i.e. with seconds).
HA
haneefm
Syncfusion Team
April 5, 2007 03:22 PM UTC
Hi Helen,
You can try this code.
string DisplayText = this.grid.Table.GetTableCellStyle(rec,"ColumnName").FormattedText;
Best regards,
Haneef
HE
Helen
April 6, 2007 06:59 AM UTC
Thanks! And how to do the same for a nested table?
HE
Helen
April 6, 2007 01:41 PM UTC
Seems that I've made that out --
string DisplayTest = (nestedTable.DisplayElements[0].ParentTable as GridTable).GetTableCellStyle(rec, "ColumnName").FormattedText;
Or is there a way to reduce the (nestedTable... as GridTable) thing?
HA
haneefm
Syncfusion Team
April 9, 2007 08:57 AM UTC
Hi Helen,
Please try this code to get the display text of the cell in a nested table.
string DisplayText = this.grid.GetTable("NestedTableName").GetTableCellStyle(rec,"ColumnName").FormattedText;
Best regards,
Haneef
HE
Helen
April 10, 2007 05:42 AM UTC
Thanks a lot!
AN
Anju
June 29, 2007 12:15 PM UTC
Hi,
I tried the solution mentioned in the post to fetch displaytext of the cell, but it did not work.
It returns the value 37964.159999 which is the value from datasource.
This value is updated to display £37.9 in 'gridGroupingControl1_TableControlDrawCellDisplayText' event by setting the value e.inner.displaytext.
Please help me to get the correct displayed value
Thanks and Regards
Anju
HA
haneefm
Syncfusion Team
June 29, 2007 09:34 PM UTC
Hi Anju,
Setting the e.Inner.DisplayText using the TableControlDrawCellDisplayText event does not store the value to grid. So, there is no direct way to access this DisplayText. But one way you could have an Hashtable, which takes the key of the corresponding cell Indentity( RowIndex and ColIndex combination) as the hashkey and the associated e.Inner.DisplayText as the hashValue. You can retrieve the corresponding hashvalue anytime using the cell Indentity( RowIndex and ColIndex combination). Please try the suggestion and let me know if this helps.
Best regards,
Haneef