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

Number Mask

Thread ID:





14373 May 25,2004 09:46 PM UTC May 26,2004 05:57 AM UTC WinForms 2
Tags: GridControl
Asked On May 25, 2004 09:46 PM UTC

Hi, How can i set mask for a range of cell or a cell in GDBG? I want user to enter only decimal values. Something like "#,###,###.##" Thanks

Replied On May 25, 2004 09:58 PM UTC

I figured it out that how to set mask. But when I am trying to enter decimal value in a cell I am getting following error “Input string was not in correct format” Just to remind that I am setting mask in GridDataBundGrid control in a multirowrecord view. Please help me. Because this my formulas are also not working. Thanks

Administrator [Syncfusion]
Replied On May 26, 2004 05:57 AM UTC

There are several ways you can approach this problem. The way I would try to do it is to make sure teh column type is set to double an dthe Format is set teh way you want it. this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.CellValueType = typeof(double); this.gridDataBoundGrid1.Binder.InternalColumns[1].StyleInfo.Format = "#,###.00"; This should allow you to enter and see teh values. And if your users types an invalid valid, you will get a message. If you want to make it so you user cannot type a invalid value, I would handle the CurrentCellValidateString event and vaildate the string with each key stroke to see if make sure the entry is valid.
private void gridDataBoundGrid1_CurrentCellValidateString(object sender, GridCurrentCellValidateStringEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(cc.ColIndex == 2)
		double d;
		if(!double.TryParse(e.Text, System.Globalization.NumberStyles.Any, null, out d))
			e.Cancel = true;


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