Click here to Skip to main content
15,886,797 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public void method()
    {
        if (ddlMarkUpType.SelectedValue=="Percent")
        {
            Label1.Visible = true;
        }
        else
        {
            Label1.Visible = false;
        }
    }
    protected void ddlMarkUpType_SelectedIndexChanged(object sender, EventArgs e)
    {
        method();
    }

Not Working
if i select a drop down value percent its not doing label1.visible = true....
Posted
Comments
Nirav Prabtani 9-Jul-13 10:04am    
be sure in SelectedValue and Item..:)
Check it by break point...:)
Arsalaan Ahmed 9-Jul-13 10:06am    
yes...
ZurdoDev 9-Jul-13 10:13am    
Use a breakpoint to see what is happening. Make sure this isn't part of an ajax postback.
Arsalaan Ahmed 9-Jul-13 10:15am    
i am also check by debugger but this is not going to SelectedIndexChanged Event...
Arsalaan Ahmed 9-Jul-13 10:19am    
if (ddlMarkUpType.SelectedValue=="Percent")
{
Label1.Visible = true;
}
this condition is always False.....

Change autopostback property of DropDown to true
 
Share this answer
 
change autopostback to true in dropdown and check that your value must be "Percent" in dropdown..............
 
Share this answer
 
Put your dropdown list autopostback=true... and check your asp page for any colliding script or validation...

That gonna solve your problem... Further to short the code dont put the logic in another method.. simply put that in ddl's selected index changed method and try to use .selectedindex rather than selectedvalue to avoid any spelling mistake.
 
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