B
BJ
I do not want the users to enter in any new items but only select from
the list I provide for them: Here is my code
'----------------------------------------------------------------------------
'-- ADD ITEMS TO THE TYPE DROP DOWN BOX
'----------------------------------------------------------------------------
sqlCMD.Connection = New
SqlConnection(ConfigurationSettings.AppSettings("con"))
sqlCMD.CommandType = CommandType.StoredProcedure
sqlCMD.CommandText = "usp_GetAppType"
'sqlCMD = New SqlCommand("SELECT DISTINCT APL_TYP_C FROM
dbo.TCPRDA ORDER BY APL_TYP_C", con)
sqlCMD.Connection.Open()
myReader = sqlCMD.ExecuteReader()
If myReader.HasRows Then
'Add blank first item. Note this will be the default
selection but user must select another value
Me.ddlType.Items.Add("")
Do While myReader.Read()
i = New ListItem(myReader.GetString(0))
Me.ddlType.Items.Add(i)
Loop
Else
i = New ListItem("No items returned")
Me.ddlType.Items.Add(i)
End If
myReader.Close()
sqlCMD.Connection.Close()
'Remove ALL from the type of application drop down list
Me.ddlType.Items.Remove("ALL")
Me.ddlType.SelectedIndex = 0
the list I provide for them: Here is my code
'----------------------------------------------------------------------------
'-- ADD ITEMS TO THE TYPE DROP DOWN BOX
'----------------------------------------------------------------------------
sqlCMD.Connection = New
SqlConnection(ConfigurationSettings.AppSettings("con"))
sqlCMD.CommandType = CommandType.StoredProcedure
sqlCMD.CommandText = "usp_GetAppType"
'sqlCMD = New SqlCommand("SELECT DISTINCT APL_TYP_C FROM
dbo.TCPRDA ORDER BY APL_TYP_C", con)
sqlCMD.Connection.Open()
myReader = sqlCMD.ExecuteReader()
If myReader.HasRows Then
'Add blank first item. Note this will be the default
selection but user must select another value
Me.ddlType.Items.Add("")
Do While myReader.Read()
i = New ListItem(myReader.GetString(0))
Me.ddlType.Items.Add(i)
Loop
Else
i = New ListItem("No items returned")
Me.ddlType.Items.Add(i)
End If
myReader.Close()
sqlCMD.Connection.Close()
'Remove ALL from the type of application drop down list
Me.ddlType.Items.Remove("ALL")
Me.ddlType.SelectedIndex = 0