使用csharp验证asp.net中的下拉列表 [英] validate the dropdownlist in asp.net using csharp
问题描述
设计屏幕如下
标签(显示信息)
学院名称下拉列表< br $>
月份下拉列表
年度下拉列表
我有一个按钮显示
当我点击显示按钮时,我想验证上述任何一个学院名称,月份和年份
未被选中。
i希望在标签中显示消息。
例如,如果教师姓名未选择显示消息未选择Faculty Name。
我怎样才能使用csharp在asp.net中进行vaidate。
问候,
narasiman P.
只需检查下拉列表中的值是否为空。
if (ComboBox.SelectedItem == null )
// 做点什么
< blockquote>尝试RequiredFieldValidator:
http://www.w3schools .com / aspnet / control_reqfieldvalidator.asp [ ^ ]
一切顺利。
Azee ......
请参阅以下文章
ASP.NET验证简介 [ ^ ]
Design screen as follows
Label (To show the message)
Faculty Name Dropdownlist
Month Dropdownlist
Year Dropdownlist
I have one button Show
When i click the Show button i want to validate if any of the above Faculty Name,Month and Year
is not selected.
i want to show the message in label.
For example if faculty name is not selected show the message Faculty Name is not selected.
for that how can i vaidate in asp.net using csharp.
regards,
narasiman P.
Simply check if the value in dropdown is not null.
if(ComboBox.SelectedItem == null) //do something about it
Try RequiredFieldValidator:
http://www.w3schools.com/aspnet/control_reqfieldvalidator.asp[^]
All the best.
Azee...
Refer below article
Introduction to ASP.NET validation[^]
这篇关于使用csharp验证asp.net中的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!