Protected Sub mode_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mode.SelectedIndexChanged
Dim StrConn As String = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim dt As New DataTable
Dim da1 As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM mode", StrConn)
da1.Fill(dt)
Dim LT As New ListItem
'LT.Text = "-- Select Mode --"
'LT.Value = ""
'mode.Items.Add(LT)
For i As Integer = 0 To dt.Rows.Count - 1
mode.Items.Add(New ListItem(dt.Rows(i).Item("mode"), dt.Rows(i).Item("id_mode")))
Next
Gridbind()
End Sub
Code2
Code (VB.NET)
Protected Sub mode_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.load
Dim StrConn As String = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim dt As New DataTable
Dim da1 As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM mode", StrConn)
da1.Fill(dt)
Dim LT As New ListItem
'LT.Text = "-- Select Mode --"
'LT.Value = ""
'mode.Items.Add(LT)
For i As Integer = 0 To dt.Rows.Count - 1
mode.Items.Add(New ListItem(dt.Rows(i).Item("mode"), dt.Rows(i).Item("id_mode")))
Next
Protected Sub DDL1()
Dim StrConn As String = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim dt As New DataTable
Dim da1 As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM mode", StrConn)
da1.Fill(dt)
Dim LT As New ListItem
'LT.Text = "-- Select Mode --"
'LT.Value = ""
'mode.Items.Add(LT)
For i As Integer = 0 To dt.Rows.Count - 1
mode.Items.Add(New ListItem(dt.Rows(i).Item("mode"), dt.Rows(i).Item("id_mode")))
Next
Gridbind()
End Sub
Protected Sub DDL2()
Dim StrConn As String = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim dt As New DataTable
Dim da1 As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM mode", StrConn)
da1.Fill(dt)
Dim LT As New ListItem
'LT.Text = "-- Select Mode --"
'LT.Value = ""
'mode.Items.Add(LT)
For i As Integer = 0 To dt.Rows.Count - 1
mode.Items.Add(New ListItem(dt.Rows(i).Item("mode"), dt.Rows(i).Item("id_mode")))
Next