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

Grid Grouping control - validation for editable cells

Thread ID:

Created:

Updated:

Platform:

Replies:

76397 Sep 4,2008 03:27 PM UTC Sep 5,2008 04:43 AM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 4, 2008 03:27 PM UTC

Hi,

I have a text box column in the grid. I want to restrict the textbox to accept only Numeric values. I would also like to put a max length restriction on that column when edited.

Thanks,
Deepa


Jisha Joy [Syncfusion]
Replied On September 5, 2008 04:43 AM UTC

Hi Deepa,

We appreciate your interest in SYncfusion Products.


TO restrict the textbox to accept only Numeric values .

This can be achieved by handling the TableControlCurrentCellKeyPress event of Grid GroupingControl. Please refer the code:


this.gridGroupingControl1. += new GridTableControlKeyPressEventHandler(gridGroupingControl1_TableControlCurrentCellKeyPress);


void gridGroupingControl1_TableControlCurrentCellKeyPress(object sender, GridTableControlKeyPressEventArgs e)
{

GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo styleInfo = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
if (styleInfo.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record
&& styleInfo.TableCellIdentity.Column.Name == "ID")
{
if (!char.IsNumber(e.Inner.KeyChar))
e.Inner.Handled = true;
}

}


Put a max length restriction on that column


Please refer the code:
this.gridGroupingControl1.TableDescriptor.Columns["ID"].Appearance.AnyRecordFieldCell.MaxLength = 3;


Please try this and let me know if this helps.

Regards,
Jisha


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

;