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

[Solved] How to prevent text input like the Demo

4 Answers 24 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kuangyi
Top achievements
Rank 1
Kuangyi asked on 15 Sep 2011, 10:24 PM
Hi, 

I've been trying to implement a gridview like that in http://demos.telerik.com/aspnet-mvc/razor/Grid/EditingServerSide/1?mode=InLine&type=Text&theme=vista&Grid-mode=edit.

What I really like is the fact that I can't type letters into the numeric fields.  I'm not sure how to add that since it seems to be done automatically. 

Looking through the page source of the demo, these seem to get automatically created (I don't see them in the source code for the demo):

jQuery('#UnitPrice').tTextBox({val:182313123123123140, step:'1', minValue:0, maxValue:79228162514264337593543950335, digits:2, groupSize:3, positive:0, negative:0, text:'Enter value', type:'currency'});
jQuery('#UnitsInStock').tTextBox({val:39, step:1, minValue:-2147483648, maxValue:2147483647, digits:0, groupSize:3, negative:1, text:'Enter value', type:'numeric'});
jQuery('#LastSupply').tDatePicker({format:'M/d/yyyy', minValue:new Date(1899,11,31), maxValue:new Date(2100,0,1), selectedValue:new Date(2011,8,15)});

They look like it's what I want, but my page doesn't have those lines.

Is there something specific I'm missing from one of my files?

4 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 16 Sep 2011, 10:04 AM
Hello Kuangyi,

The component used in this demo is the NumericTextBox and yes - it validates the input automatically.

Greetings,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kuangyi
Top achievements
Rank 1
answered on 19 Sep 2011, 04:09 PM
Thanks for the reply.

Where in the code is this specified?  I can't find any references to NumericTextBox in the view.
0
Accepted
Dimo
Telerik team
answered on 19 Sep 2011, 05:10 PM
Hello Kuangyi,

The numeric textbox generation is due to two things:

1. Integer data type for the field:

[Required]
[DisplayName("Units in stock")]
[DataType("Integer")]
public int UnitsInStock
{
    get;
  set;
}


2. Existence of an Integer.ascx editor template in the Shared views folder.


For more information on the matter, please refer to:

http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-display-and-editor-templates.html


All the best,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Kuangyi
Top achievements
Rank 1
answered on 19 Sep 2011, 07:22 PM
Thank you very much.
Tags
General Discussions
Asked by
Kuangyi
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Kuangyi
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or