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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridGroupingControl CellType

Thread ID:





33792 Aug 26,2005 06:51 AM UTC Aug 29,2005 08:36 AM UTC WinForms 4
Tags: GridControl
Asked On August 26, 2005 06:51 AM UTC

Hi. I have a text column in my datasource and I need display this column values different ways depend on a correspond values in another column. So I try this: private void gridGroupingControl1_QueryCellStyleInfo( object sender, GridTableCellStyleInfoEventArgs e ) { if ( e.TableCellIdentity.Column != null && e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && e.TableCellIdentity.Column.Name == "Value" ) { DataRowView row = (DataRowView)e.TableCellIdentity.DisplayElement.GetData(); switch ( (Byte)row["ValueType"] ) { case 2 : e.Style.CellValueType = typeof(DateTime); e.Style.CellType = "MonthCalendar"; break; case 3 : e.Style.CellValueType = typeof(int); e.Style.CellType = "ComboBox"; e.Style.ExclusiveChoiceList = true; e.Style.DisplayMember = "Text"; e.Style.ValueMember = "Id"; e.Style.DataSource = MyListItem.GetDataSource(); break; default: e.Style.CellType = "TextBox"; break; } e.Handled = true; } } It''s work normal when I click in combo-cell (case 3). But when I leave my combo-cell it displays empty value.

Administrator [Syncfusion]
Replied On August 26, 2005 11:46 AM UTC

Are you seeing any exceptions being displayed in your output window as you move off the cell? You may have to handle SaveCellStyleInfo, and in this case, make sure the proper value is being saved. If you just want to change how teh text is displayed, you can use TableControlDrawCellDisplayText and avoid working with QueryCellStyleInfo and SaveCellStyleInfo.

Replied On August 29, 2005 03:10 AM UTC

1. I am not seeing exceptions. 2. I can''t find SaveCellStyleInfo event if search over all Studio Documentation. 3. I sure the proper value is being saved because this cell displays last assigned selection next time I click it. 4. I not only want change how text is displayed but I need change way how it assigned (like typed columns).

Administrator [Syncfusion]
Replied On August 29, 2005 07:43 AM UTC

I am sorry. I should have written SaveCellFormattedText instead of SaveCellStyleInfo. Here is a sample that does everything in QueryCellStyleInfo. http://www.syncfusion.com/Support/user/uploads/GGC_CellTypesChangeWithColumnValue_871dc1f7.zip The one tricky part is what do you want to happen if the cell is a TextBox with ABC in it, and your user changes the value in the other column so the cell now should be a DateTime. In this case, your DataSource still has ABC in it, but this value does not represent a valid DateTime. The sample tries to catch these problems using either double.TryParse or just a try-catch, and then changes the value to someproper default.

Replied On August 29, 2005 08:36 AM UTC

Your DataTable Value column is Object type while my is Varchar. But seeing your example code I try assign value to e.Style.CellValue in each query. It solve my problem. Thank you very much! And sorry for my English. :)


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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