dwezil
asked on
How can I make a message box pop up if no selection is made from a dropdown list but the submit button is clicked.
I need to make a message box pop up if a user doesnt select anything from my ddl but clicks the submit button. Id like my statement to stop wokring at this point too. Any help would be superb, thanks!
protected void btnSubmit_Click(object sender, EventArgs e)
{
string connectionString = "Server = *****;Database =****;User ID =*****;Password=********;Trusted_Connection = False; MultipleActiveResultSets=True" ;
SqlConnection myConnection = new SqlConnection(connectionString);
myConnection.Open();
string EngineerID=null;
string commandString1 = "SELECT EngineerID FROM tblNewCategory Where Category like '" + ddlCategory.SelectedValue + "'";
SqlCommand myCommand1 = new SqlCommand(commandString1, myConnection);
SqlDataReader myReader1 = myCommand1.ExecuteReader();
myReader1.Read();
if (myReader1.HasRows)
{
EngineerID = myReader1.GetInt16(0).ToString();
}
myReader1.Close();
sorry last comment is realted to windows app ... not for web
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Spot on mate cheers!
Open in new window