Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How do I code to enable a button on selecting from a drop down list?





C#
protected void ddl_Disb_Routine_SelectedIndexChanged(object sender, EventArgs e)
      {
          btn_Process.Enabled = true;
      }
Posted
Comments
[no name] 28-Sep-14 12:57pm    
Just...like...you...are....doing?
Member 10744248 28-Sep-14 15:22pm    
ITS NOT WORKING
[no name] 28-Sep-14 16:44pm    
Screaming at me isn't going to make it work. Whatever "not working" means. Excuse me for not having the ability to read your mind.

Just check AutoPostBack is set to true in your aspx page.
C#
AutoPostBack="true"
 
Share this answer
 
check auto post back property
 
Share this answer
 
try something like this ...
I have just added conditions..

C#
protected void ddl_Disb_Routine_SelectedIndexChanged(object sender, EventArgs e)
{
    if (DropDownList1.SelectedIndex == 0)
    {
        btn_Process.Enabled = true;
    }
    else
    {
        btn_Process.Enabled = false;
    }
}
 
Share this answer
 
Please check
HTML
AutoPostBack="true"
as the solution 2

If it not working please check in your page_load method, there may you have
C#
btn_Process.Enabled = false;


If it is, please keep it inside the if(!postback) condition.

please update me
 
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