如何在Asp.net中为“搜索"页面设置DefaultButton [英] How to set DefaultButton for Search page in Asp.net

查看:50
本文介绍了如何在Asp.net中为“搜索"页面设置DefaultButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的应用程序中的搜索网页.当您按Enter键然后在我的页面中触发搜索链接"按钮时,我们正在输入或选择asp.net控件的文本.我在搜索页面中为表单和面板控件设置了DefaultButton.它工作正常.但是这里的问题是我有一个带有验证的文本框,并为面板或搜索"页面中的表单"设置DefaultButton的属性.验证不适用于文本框.

例如:我有一个textbox.它只能接受数字,并且使用事件是onkeypress ="return onlyNumbers()".在客户端写验证书.主要问题是无法正常工作.未经验证就可以了.
因为我的申请即将截止,所以这是主要原因. 您能帮我任何一个人吗......

I am developing the search web page in my Application. We are entering or selecting text of asp.net controls when pressing the enter key then fire the Search Linkbutton in my page. I was set the DefaultButton for forms and panel control in search page. It works fine. But here problem is i have a textbox with validations and set the property of DefaultButton for panel or Forms in Search page. Validation doesn''t working for textbox.

For Example: I have a textbox . It can take only Numbers and using event is onkeypress="return onlyNumbers()". wrote the validaion at client side. the main problems is doesn''t work validaions. without validation it is fine.
Because my application is coming to deadline, that is the main reason.
Could you help me any one please.........

推荐答案

这意味着您的验证逻辑不正确.三种方式:
1.使用Custom或RegularExpression验证程序仅处理数字OR
2.使用文本框的onBlur客户端事件引发验证问题警报或
3.使用带遮罩的文本框,该文本框将仅允许输入整数.

设置DefaultButton只需提交页面(按Enter键)以及相关的按钮单击事件.
This means your validation logic is not correct. Three ways:
1. Use Custom or RegularExpression validator to handle only numbers OR
2. Use onBlur client side event of the textbox to raise the validation issue alert OR
3. Use masked textbox that will allow only integers to be entered in it.

Setting DefaultButton just submits the page(on pressing enter key) with the associated button click event.


这篇关于如何在Asp.net中为“搜索"页面设置DefaultButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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