我在组合框中有两个项目,因此我希望用户在单击“提交"之前必须选择项目. [英] i have two items in the ComboBox so i want the user to be compulsary to choose item before he/she click Submit.

查看:62
本文介绍了我在组合框中有两个项目,因此我希望用户在单击“提交"之前必须选择项目.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在组合框中有两个项目,因此我希望用户在单击提交"之前必须先选择项目.

i have two items in the ComboBox so i want the user to be compulsary to choose item before he/she click Submit.

推荐答案

请参考相同的内容已经问过的问题:-

我想让一个用户与在C#中的ComboBox上进行比较 [
Please refer to the same question already asked:-

i want to make a user to be comparsary to selet on the ComboBox in c#[^]


OnClientClick =" javascript:return ValidateSaveRegion()

这是您的提交按钮中validateSaveRegion()上方的javascript调用,并将其以aspx格式编写在下面的代码中,可以正常工作...尝试


OnClientClick="javascript:return ValidateSaveRegion()

this is javascript call above validateSaveRegion()in your submit button and write this below code in aspx it wil work...try


function ValidateSaveRegion() {
  var Name = document.getElementById(cntPlcHolder_CmboxName;);
          
           if (Name.value == "";) {
               alert(Enter Name;);
               Name.focus();
               return false;
           }


if (ComboBox1.SelectedIndex!=-1)
{
//Go Further
}
else
{
MessageBox.Show("Please select");
}


这篇关于我在组合框中有两个项目,因此我希望用户在单击“提交"之前必须选择项目.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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