如何在Gridview文本框中验证为数字 [英] How validate in Gridview textbox as numeric

查看:76
本文介绍了如何在Gridview文本框中验证为数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个gridview和最后一列作为数字列.

我想验证,GridView文本框应只允许数字.

如何做到这一点..?

Hi,

I have one gridview and last column as numeric columns.

I want to validate and gridview textbox should allow only numeric.

Ho to do this..?

推荐答案

我发现
I found this[^] had been asked some time ago.
The solutions given there are fairly accurate and should help you out.


假设您希望使用类型int.验证文本框属性Text的唯一可靠方法是调用int.TryParse(string).

请参阅
http://msdn.microsoft.com/en-us/library/f02979c7.aspx [ ^ ].

其他所有整数类型也是如此.

—SA
Suppose you expect the type int. The only reliable way to validate the property Text of the text box is to call int.TryParse(string).

See http://msdn.microsoft.com/en-us/library/f02979c7.aspx[^].

Same thing goes for all other integer types.

—SA


这篇关于如何在Gridview文本框中验证为数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆