Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Expert

need to enable a button based on the outome of a drop down list as follows


C#
protected void ddl_Moratorium_SelectedIndexChanged(object sender, EventArgs e)
       {
           if (ddl_Moratorium.Text != "NONE")
               txt_Morat_Mths.Enabled = false;
       }



How do you do it?


Thanks
Posted
Comments
MuhammadUSman1 26-Aug-14 6:24am    
I couldn't understand your question?
"based on the outome of a drop down list as follows" what is outcome of dropdown list?

try this...

C#
protected void ddl_Moratorium_SelectedIndexChanged(object sender, EventArgs e)
       {

           if (!((ddl_Moratorium.SelectedItem.Text).Equals("NONE")))
               txt_Morat_Mths.Enabled = false;

       }


To get the text of the item selected in your dropdown list you should use

Dorpdown1.SelectedItem.Text
 
Share this answer
 
v2
C#
protected void ddl_Moratorium_SelectedIndexChanged(object sender, EventArgs e)
       {
           if (ddl_Moratorium.Text != "NONE")
               txt_Morat_Mths.Enabled = false;
           else 
               txt_Morat_Mths.Enabled = true;
//unclear what exactly you want to do?
       }
 
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