Question : dropdown validation

hi All,

I have one drop down on my page and I want to code on the back if user select option 1 bind search 1
option2 bind seach 2 once they hit search.


//how can I have something like this:
//not working:
if  ddlLocation.SelectedValue ==2
{
 if ((!IsEmpty(txtFirstName.Text)) || (!IsEmpty(txtLastName.Text)) || (!IsEmpty(txtDateOfBirth.Text)) )
        {
            Bind_Patients();
        }
else
{
   Bind_Patientsla();  
}
}

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
//so far I have this:
 protected void btnSearch_Click(object sender, EventArgs e)
    {
        
        
        if ((!IsEmpty(txtFirstName.Text)) || (!IsEmpty(txtLastName.Text)) || (!IsEmpty(txtDateOfBirth.Text)) )
        {
            Bind_Patients();
        }
        else
        {
          Bind_Patientsla();  
        }

    }

Answer : dropdown validation

can you try ddlLocation.SelectedIndex == 2. if you are trying to validate the 3rd value in the drop down.
Random Solutions  
 
programming4us programming4us