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

Adding a Numeric Text box as a cell type

Thread ID:

Created:

Updated:

Platform:

Replies:

78693 Dec 23,2008 04:05 PM UTC Dec 24,2008 09:54 AM UTC WinForms 2
loading
Tags: GridControl
Sameer Khan
Asked On December 23, 2008 04:05 PM UTC

How do I add a Numeric Cell Box [or any other user control] as a cell type for a GridGroupingControl Column?


Sameer Khan
Replied On December 23, 2008 04:06 PM UTC

btw .. I tried adding the following code:

e.Style.Control = new NumericTextBox();

and it doesn't seem to work

>How do I add a Numeric Cell Box [or any other user control] as a cell type for a GridGroupingControl Column?




Nisha Arockiya A [Syncfusion]
Replied On December 24, 2008 09:54 AM UTC

Hi Sameer,

Thanks for your interest in syncfusion Products.

You can place an UserControl in a single cell using Style property in QueryCellStyleInfo event .Please refer to the code below:

private Dictionary controls = new Dictionary();

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
GridColumnDescriptor columnDescriptor = e.TableCellIdentity.Column;
if (e.TableCellIdentity.RowIndex == 6 && e.TableCellIdentity.ColIndex == 5)
{
controls.Add(e.TableCellIdentity, new UserControl1());
e.Style.CellType = "UserControl1";
e.Style.Control = controls[e.TableCellIdentity];
}
}



The Control celltype is only intended to be used in a single cell. There is no mechanism implemented to move values from the cell style to the control or from the control to the cellstyle which is how you can use a single control among many cells.

If you want to use a control for multiple cells, then the recommended way would be to derive your own cell control. You would override the renderer's OnInitialize method to move the state information from the style object to your control. Your would also override the OnSaveChanges method to move the state information from your control back to the style. These are the techniques used for sharing controls. There are several samples listed in the Users Guide, and there are several more in the CellTypes samples folder. If you do a search for CellRenderer in our Samples folder, you will see many, many hits for derived cell controls.

Let me know if you have further questions on this matter.

Regards,
Nisha



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

;