I am trying to disable a button on page load. my current code is the following, but when I open the page the button is active.
protected void Page_Load(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(DropDownList5.SelectedValue))
Button1.Enabled = true;
else
Button1.Enabled = false;
}
Albert D. Kallal's comment resolved my issue.