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.
Syncfusion Feedback

Column format with contextmenu

Thread ID:

Created:

Updated:

Platform:

Replies:

46994 Jul 26,2006 10:26 AM UTC Jul 26,2006 12:59 PM UTC Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 26, 2006 10:26 AM UTC

Hi,

we are using a GGC to display our data. The control is bound to a dataset object. Now I have implemented a context menu which shows up when a user clicks on a column header. The context menu offers the user to change the column format. So if we have a column full of double values - he can change the format string with something like this:

GridTableDescriptor childTD = test.TableControl.TableDescriptor;
GridTableCellStyleInfo myStyle = childTD.Columns[test.ColumnIndex].Appearance.AnyRecordFieldCell;
myStyle.Format = "##.00000000";

This works fine. Though we have also columns which contains string values, and therefore I don''t wann show that context menu with the format option. Cause it doesn''t make sense to set the "myStyle.Format" string for a string value. My question is now, how can I find out if the underlying data is of kind numeric or of kind string (to enable or disable the format option in my context menu). I didn''t find out how to get the data type of the underlying data of a column. Hope somebody understands my question :-)

Kind regards
Tim

Administrator [Syncfusion]
Replied On July 26, 2006 12:32 PM UTC

Hi Tim,

Please try handling the MouseUp event of the TableControl, there you can check for the cellvaluetype(datatype) of the column like in the code below.


// TableControl_MouseUp event
GridTableDescriptor td = this.gridGroupingControl1.TableDescriptor;
Point pt = new Point(e.X, e.Y);
GridTableCellStyleInfo style =this.gridGroupingControl1.TableControl.PointToTableCellStyle( pt );
if(td.Columns[style.TableCellIdentity.Column.Name].Appearance.AnyRecordFieldCell.CellValueType == typeof(string))
{
/// code to enable/disable menu item in contextmenu ////
}


Here is a rough sample, that demonstrates, the way you could show only certain menu items based on the data type of the column.
GGC_ContextMenu.zip

Let me know if you need any further assistance.
Regards,
Rajagopal


Administrator [Syncfusion]
Replied On July 26, 2006 12:59 PM UTC

You are great - this works just fine for me. Besides - your response time is really great - keep it up guys :-)

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.

Warning Icon 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.Close Icon

;