This is a migrated thread and some comments may be shown as answers.

GridViewTextBoxColumn Only Numbers Allowed

3 Answers 755 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramasamy
Top achievements
Rank 1
Ramasamy asked on 23 Sep 2013, 09:57 AM
Hello,

I am using Radgridview and i have N number of Columns. While doing Add/Edit a row, on a particular column user should allow only numbers(0 to 10) to type/fill. The user can also copy paste on this cell/column in that case it should only allow to paste numbers.
Can any one help me on this?

Thanks & Regards
Rams

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 26 Sep 2013, 11:07 AM
Hi Ramasamy,

Thank you for writing back.

The best way for you to achieve this behavior will be to use GridViewDecimalColumn. This way you will be able to set Мaximum and Мinimum value. Also if the user pasteс bigger or smaller value the cell value would be rounded when the cell is in edit mode. For the case where the cell is not in edit mode and you paste in it, you can use the Pasting event to handle it.

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ramasamy
Top achievements
Rank 1
answered on 27 Sep 2013, 06:50 AM
Hi Dimitar,

Thanks for the reply. I have already tried the GridViewDecimalColumn and could't get the desired outcome. If we use the GridViewDecimalColumn it round off with decimal places, I have already tried with out decimal places as well with GridViewDecimalColumn

May be some sample would be helpful. Can you provide some validation sample to allow only number in the GridViewTextColumn/GridViewDecimalColumn?

Thanks & Best Regards
Ramasamy.P

 
0
Dimitar
Telerik team
answered on 02 Oct 2013, 06:29 AM
Hello Ramasamy,

Thank you for writing back.

What I think will be suitable for you case will be to use combination of GridViewMaskBoxColumn and some extra validation in the CellValidating event. This way you will always have appropriate values in this column. Please refer to the attached project.

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Ramasamy
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Ramasamy
Top achievements
Rank 1
Share this question
or