Wednesday, March 28, 2012

Pre selected item in a cascading dropdownlist

I have a set of 3 dropdowns that im using the cascading dropdownlist ajax with. They all load corectly with the webservice and work great, but the form is an inventory entry screen and I need to update an existing inventory sometimes. So is there a way to pre-select all 3 dropdown list boxes? I tried "CascadingDropDown1.SelectedValue = "MACK";" but it gets erased when the webservise returns the data.


Maybe you got it solve by the date, but i figure out a way to lead with cascadingDropdownlist and preselection.
In my case I have 3 dropdownlist (ddl) inside a formview and depending is a session variable is already filled the value for the first DDL (parent) is changed.

In the following code, FvwPostOff is a formview which contents my DDL and CascadingDropDown (CddBuilding) extenders. The thing is to set the value by the CascadingDropdown extender instead of the DDL direclty:

ElseIf (Session("BUILD_NB") IsNotNothing)Then Try Dim CddBuildingAs CascadingDropDown = FvwPostOff.FindControl("CddBuilding") CddBuilding.SelectedValue = Session("BUILD_NB")Catch exAs IndexOutOfRangeException' nothingEnd Try End If
Hope this help

No comments:

Post a Comment