在C#中使用组合框进行验证 [英] Validation in combobox in C#
本文介绍了在C#中使用组合框进行验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的webform中使用组合框。我希望使用参数化查询验证我的combobox.i。如果我没有选择任何项目,以便消息框正常工作,但在此错误消息后调用。请检查并指导我如何解决这个问题。
我尝试过:
i am using comboboxes in my webform.i want to validate to my combobox.i am using parameterized query. if i do not select any item so a messagebox is working properly but after that error messages invokes. please check and guide me how to solve this problem.
What I have tried:
if (string.IsNullOrEmpty(comboproductcategory.SelectedText))
{
MessageBox.Show("please select the item");
}
else if (comboproductcategory.SelectedText == " ")
{
cmd.Parameters.AddWithValue("@ProductCategory",comboproductcategory.SelectedItem);
}
else
{
MessageBox.Show("select again");
}
推荐答案
您可以使用Jquery表单验证IO来实现验证。插件很棒
you can use Jquery form validation IO with that you can achieve the validation. that plug in is superb
这篇关于在C#中使用组合框进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文