I have ShowValue
working. Now, on the last line I need to call the function newFunction
to repopulate the dropdownlist
object on the onClick
event.
I am getting errors when I click the dropdownlist
down arrow.
How do I get the two to hand shake with each other?
My code:
Public Sub ShowValue(ByVal sender As Object, ByVal e As System.EventArgs)
lblupdatePanel.Text = DropDownList1.SelectedValue.ToString
Dim LocationDescription2 As DropDownList = CType(dvContact.FindControl("LocationDescription2"), DropDownList)
Dim LocationLogic As New LocationBLL
LocationDescription2.DataSource = LocationLogic.GetUnitByUnitID(DropDownList1.SelectedValue.ToString)
LocationDescription2.DataTextField = "LocationDescription"
LocationDescription2.DataValueField = "LocationCode"
LocationDescription2.SelectedValue = DropDownList1.SelectedValue.ToString
LocationDescription2.DataBind()
LocationDescription2.Attributes.Add("onclick", "newFunction(what to put here?);")
End Sub
Public Sub newFunction(ByVal sender As Object, ByVal e As System.EventArgs)
Dim LocationDescription2 As DropDownList = CType(dvContact.FindControl("LocationDescription2"), DropDownList)
Dim DivisionDescription1 As DropDownList = CType(dvContact.FindControl("DivisionDescription1"), DropDownList)
Dim LocationLogic As New LocationBLL
LocationDescription2.DataSource = LocationLogic.GetLocationByDivisionCode(DivisionDescription1.SelectedValue.ToString)
LocationDescription2.DataTextField = "LocationDescription"
LocationDescription2.DataValueField = "LocationCode"
LocationDescription2.DataBind()
End Sub