Reidar,
I made this sample for you now. So test it well when you want to use it.
It uses a shared sub which should be dealed by all active sessions at that
moment in this application.
I hope this helps?
Cor
\\\
Private Sub DropDownList1_SelectedIndexChanged(ByVal _
sender As System.Object, ByVal e As System.EventArgs) _
Handles DropDownList1.SelectedIndexChanged
mycitys.dv.RowFilter = "Countries = '" & _
DropDownList1.SelectedValue & "'"
DropDownList2.DataSource = mycitys.dv
DropDownList2.DataTextField = "Cities"
DropDownList2.DataBind()
End Sub
Private Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
DropDownList1.Items.Clear()
DropDownList1.Items.Add("France")
DropDownList1.Items.Add("Holland")
If mycitys.dv Is Nothing Then
myCitys.CreateDT()
End If
mycitys.dv.RowFilter = "Countries = 'France'"
DropDownList2.DataSource = mycitys.dv
DropDownList2.DataTextField = "Cities"
DropDownList2.DataBind()
End If
End Sub
End Class
Public Class myCitys
Public Shared dv As DataView
Public Shared Sub CreateDT()
Dim dt As New DataTable
dt.Columns.Add("Countries")
dt.Columns.Add("Cities")
dt.Rows.Add(dt.NewRow)
For i As Integer = 0 To 3
dt.Rows.Add(dt.NewRow)
Next
dt.Rows(0).ItemArray = New Object() _
{"France", "Paris"}
dt.Rows(1).ItemArray = New Object() _
{"France", "Lyon"}
dt.Rows(2).ItemArray = New Object() _
{"Holland", "Amsterdam"}
dt.Rows(3).ItemArray = New Object() _
{"Holland", "Rotterdam"}
dv = New DataView(dt)
End Sub
///