How to update control state in asp.net/ajax?

Posted by darth_alexious on Stack Overflow See other posts from Stack Overflow or by darth_alexious
Published on 2011-03-11T15:59:51Z Indexed on 2011/03/11 16:10 UTC
Read the original article Hit count: 265

I'm trying to update certain controls according to a selection in a dropdown list.

For example, in the "selectedIndexChanged" event of a dropDownList, if a user selects the value "sport-car" the text box "payload" is disabled and the textbox "max speed" is enabled.

    private sub dropDownList1_SelectedIndexChanged(byval sender as object, byval e as eventargs) handles dropDownList1.SelectedIndexChanged

    If dropDownList1.selectedValue = "sport-car" then

     textBox_payLoad.enabled = false
     textBox_maxSpeed.enabled = true

    end if

end sub

When I'm doing something like this, the controls aren't enabled/disabled, even the event (wich I've added a breakpoint) seems not to be raised (sometimes several time after it is raised). Also, when the instructions in the condition is executed, nothing changes.

What am I doing wrong? Maybe this is a very easy issue, but I'm a begginer in MS Visual Web Developer.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about web-development