在asp.net中,文本框不应为空 [英] textbox should not be empty in asp.net

查看:316
本文介绍了在asp.net中,文本框不应为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果文本框为空,则出现错误消息,有关文本更改事件..
我想要该代码...请帮助我..

if textbox is empty then error message is there,on text changed event..
i want code for that...plz help me..

推荐答案

我想要该代码
:doh:
它在这里不能这样工作.

这是询问者的期望:
1. 先尝试您要做什么!您可能会发现它并不难.
2.制定看起来像问题/无法解决的问题.

试试看,告诉他们是否遇到问题.
成员将很乐意为您提供帮助.



现在,您需要:
选项#1:
在客户端本身上处理/验证它.使用RequiredFieldValidator或定义页面的JavaScript onsubmit事件,在该事件中检查文本框是否具有值

选项#2:
页面回发后,在Submit事件(如果有一个按钮提交了页面)中,查找文本值,并在值不为空的情况下显示一条消息.

到目前为止,我建议选择1.
尝试并发布特定问题(如果有).
i want code for that
:doh:
It does not work like this here.

Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it''s not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.



For now, you need to:
Option #1:
Handle/Validate it on client side itself. Use RequiredFieldValidator OR define a JavaScript onsubmit event of page where you check if the textbox has value or not

Option #2:
After page postback, in the submit event (if a button submitted the page), look for the text value and show a message in case value is nothing.

I would by far suggest option 1.
Try out and post specific issues if you have any.


这篇关于在asp.net中,文本框不应为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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