L
Leon
Does anyone see my mistake? I'm trying to load the school dropdownlist when
the user select a state from the state dropdownlist. The states drop down
list loads, but the school drop down list donot.
****Database Object Class........................
' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Function GetStateList() As DataSet
Return RunProcedure( _
"GetState", New IDataParameter() {}, "States")
End Function
Public Function GetSchoolByStateList(ByVal StateID As String) As
DataSet
Dim parameters As SqlParameter() = { _
New SqlParameter("@StateID", SqlDbType.VarChar, 2)}
parameters(0).Value = StateID
Return RunProcedure( _
"GetSchoolByState", New IDataParameter() {}, "SchoolByState")
End Function
****Business Object Class........................
' Private variables
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Private Shared myStateID As String
' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Shared Function GetStates() As DataSet
Dim tool As New StuLotto.Accounts.Data.AccountsTool
Return tool.GetStateList
End Function
Public Shared Function GetSchoolByState() As DataSet
Dim tool As New StuLotto.Accounts.Data.AccountsTool
Return tool.GetSchoolByStateList(myStateID)
' Properties
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Shared Property StateID() As String
Get
Return myStateID
End Get
Set(ByVal value As String)
myStateID = value
End Set
End Property
End Class
End Function
****.aspx Codebehind page...........................
' Bind the state drop-down combobox
Dim States As New DataSet
States = Accounts.Business.AccountsTool.GetStates
SStateDDL.DataSource = States
SStateDDL.DataTextField = "Description"
SStateDDL.DataValueField = "StateID"
SStateDDL.DataBind()
' Bind the school by selected state drop-down combobox
Private Sub SStateDDL_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
SStateDDL.SelectedIndexChanged
Dim Schools As New DataSet
Dim Value As String = _
Accounts.Business.AccountsTool.StateID =
SStateDDL.SelectedItem.Value
Schools = Accounts.Business.AccountsTool.GetSchoolByState
SNameDDL.DataSource = Schools
SNameDDL.DataTextField = "SchoolName"
SNameDDL.DataValueField = "SchoolID"
SNameDDL.DataBind()
End Sub
the user select a state from the state dropdownlist. The states drop down
list loads, but the school drop down list donot.
****Database Object Class........................
' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Function GetStateList() As DataSet
Return RunProcedure( _
"GetState", New IDataParameter() {}, "States")
End Function
Public Function GetSchoolByStateList(ByVal StateID As String) As
DataSet
Dim parameters As SqlParameter() = { _
New SqlParameter("@StateID", SqlDbType.VarChar, 2)}
parameters(0).Value = StateID
Return RunProcedure( _
"GetSchoolByState", New IDataParameter() {}, "SchoolByState")
End Function
****Business Object Class........................
' Private variables
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Private Shared myStateID As String
' Methods
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Shared Function GetStates() As DataSet
Dim tool As New StuLotto.Accounts.Data.AccountsTool
Return tool.GetStateList
End Function
Public Shared Function GetSchoolByState() As DataSet
Dim tool As New StuLotto.Accounts.Data.AccountsTool
Return tool.GetSchoolByStateList(myStateID)
' Properties
'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
Public Shared Property StateID() As String
Get
Return myStateID
End Get
Set(ByVal value As String)
myStateID = value
End Set
End Property
End Class
End Function
****.aspx Codebehind page...........................
' Bind the state drop-down combobox
Dim States As New DataSet
States = Accounts.Business.AccountsTool.GetStates
SStateDDL.DataSource = States
SStateDDL.DataTextField = "Description"
SStateDDL.DataValueField = "StateID"
SStateDDL.DataBind()
' Bind the school by selected state drop-down combobox
Private Sub SStateDDL_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
SStateDDL.SelectedIndexChanged
Dim Schools As New DataSet
Dim Value As String = _
Accounts.Business.AccountsTool.StateID =
SStateDDL.SelectedItem.Value
Schools = Accounts.Business.AccountsTool.GetSchoolByState
SNameDDL.DataSource = Schools
SNameDDL.DataTextField = "SchoolName"
SNameDDL.DataValueField = "SchoolID"
SNameDDL.DataBind()
End Sub