I have a dropdownlist that displays “Select“, I want to insert an event handler in my code behind file using c#. So that when “Select” is selected in the dropdownlist it will display a warning message on the webpage.
Curretnly I have:
protected void UpdateEmployeeBTN_Click(object sender, EventArgs e) { if (DropDownListEmployee.SelectedValue == "Select") { Response.Write("warning"); return false; } update code... }
I get an error/warning message for the return statement: “returns void, a return keyword must not be followed by an object expression”.
The problem is here:
Your event handler is declared as void – you cannot return a
bool. Just doreturn;