Click here to Skip to main content
15,908,445 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have two items in the ComboBox so i want the user to be compulsary to choose item before he/she click Submit.
Posted

Please refer to the same question already asked:-

i want to make a user to be comparsary to selet on the ComboBox in c#[^]
 
Share this answer
 
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


C#
function ValidateSaveRegion() {
  var Name = document.getElementById(cntPlcHolder_CmboxName;);
          
           if (Name.value == "";) {
               alert(Enter Name;);
               Name.focus();
               return false;
           }
 
Share this answer
 
v2
C#
if (ComboBox1.SelectedIndex!=-1)
{
//Go Further
}
else
{
MessageBox.Show("Please select");
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900