Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi
in one
i have one dropdown in which
dropdown selected change even
am checking like
C#
if(ddl.selctedindex>0)
{
    function();
}
else
{
    function2();
}
function()
{
    combobox1.enable=false;
}

function2()
{
    combobox1.enable=true;
}


but it not working if am doing same operation 2 to 3 time its working
Posted
Updated 1-Mar-11 8:14am
v3

The drop down list don't have a property like 'enable' as in your code combobox1.enable. It should be Enabled instead
 
Share this answer
 
v2
Apply the followings:
Set
AutoPostBack="True"

C#
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddl.SelectedIndex > 0)
        {
            function();
        }
        else
        {
            function2();
        }
    }


C#
protected void function()
{
    ddl.Enabled = false;
}
protected void function2()
{
    ddl.Enabled = true;
}

I hope the above information will be helpful. If you have more concerns, please let me know.
 
Share this answer
 
v2
Your question is not very much clear, but try this:
JavaScript
if(ddl.selctedindex>0)
{    
   combobox1.enable=false;
}
else
{    
   combobox1.enable=true;
}


In case you still face issue, then enable Javascript debugging in your IE and then put "debugger;" at the start of this method. See how the execution is happening and if something is unexpected.
 
Share this answer
 
Comments
karthikkushala 2-Mar-11 23:19pm    
i did same its working but when am enable =true it not get enableing in first click
Sandeep Mewara 3-Mar-11 0:12am    
You surely must be disabling it in your pageload.

Check if you missed putting it in IsPostback.

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