linq to sql C#验证文本框 [英] linq to sql C# validate textbox

查看:60
本文介绍了linq to sql C#验证文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助我>>我在我的页面中有文本框,我想检查用户

在文本框中输入的值,如果在linq中退出到sql类,或者不是,如果):



从下面的评论中复制的其他信息

我有两个TextBoxs



一个textbox1用于输入身份证号码..

一个textbox2输入请求号码



和Button1 =下一步>> 启用=假

Button2 =注册>> 启用=假



我想要的>>>



我希望用户输入身份证号码,我想检查数据库中存在的其他号码我们不是

如果它exists set Button1 enable = true ..

如果没有找到我想启用= false请求号码的textbox2并设置Button2启用true哪个能够用户注册她/他的身份号码。



如果您有任何想法,请帮助我..



从以下评论中复制的其他信息2

好​​的先生我真的很抱歉...



这是我的代码我的事情它有一些问题。 。



can any one please help me >> I have textbox in my page and I want to check the value when user
enter in textbox if exit in a linq to sql class or not if ):

additional information copied from comment below
I have two TextBoxs

One textbox1 for enter " Identity card No" ..
one textbox2 for enter " Request Number "

And Button1="Next" >> "Enable=false"
Button2="Register">> "Enable=false"

What I want >>>

I want the user to enter the Identity card number and I want to check other the number is exist in database our not
if it exist set Button1 enable= true ..
if not found I want to enable=false the textbox2 of Request Number and set Button2 enable true which able user to register her/his identity number ..

please help me if you have any idea ..

additional information copied from comment below 2
okay Sir I'am real sorry for that...

this is my code I thing it have some problem ..

<script type="text/javascript">

       function keyPress(sender, args) {
           var text = sender.get_value() + args.get_keyCharacter();
           if (!text.match('^[0-9]+$')) 
               args.set_cancel(true);
               
           
       }

    </script>

 <telerik:RadTextBox ID="Identity"  runat="server" Skin="Outlook"
  Height="26px" Width="155px" LabelWidth="32px" style="text-align: center"><clientevents önkeypress="keyPress"></clientevents>

推荐答案

'))
args.set_cancel(true);


}

< / script>

< telerik:RadTextBox ID = Identity runat = server Skin = Outlook
高度= 26px宽度= 155px LabelWidth = < span class =code-string> 32px style = text-align:center><clienteventsönkeypress= keyPress>< / clientevents>
')) args.set_cancel(true); } </script> <telerik:RadTextBox ID="Identity" runat="server" Skin="Outlook" Height="26px" Width="155px" LabelWidth="32px" style="text-align: center"><clientevents önkeypress="keyPress"></clientevents>


使用page意味着基于Web的项目 - 在这种情况下你不想使用Linq to SQL,因为那需要C#,并且意味着每次都是用户更改文本框中的单个字符,它需要这是一次服务器之旅,从那里对SQL服务器进行一次访问,然后返回客户端验证文本框。



你有什么想法吗?那将会使用的慢,尴尬和恼人的

确切地确定你想要实现的目标 - 因为我没有比Wes Aday更真实的想法 - 并寻找一个基于客户端的解决方案 - 这意味着Javascript或jQuery。

除非你喜欢别人去别的地方而且永远不会回来,那就是......
The use of "page" implies a web based project - in which case you do not want to use Linq to SQL, since that requires C#, and means that every time teh user changes a single character in the text box, it requires a trip to the server, a side visit to SQL server from there, and a trip back to the client to validate the textbox.

Do you have any idea how slow, awkward and annoying that would be to use?
Decide exactly what it is you are trying to achieve - because I have no real idea any more than Wes Aday does - and look for a client based solution - which means Javascript or jQuery.
Unless you like people going elsewhere and never coming back, that is...


这篇关于linq to sql C#验证文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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