DropDownListBox: I want to 'limit to list'

  • Thread starter Thread starter julie6232000
  • Start date Start date
J

julie6232000

I don't want the users to type in any new items but select only what is
on the list.

Here's my code to load the ASP:DropDownList:

'----------------------------------------------------------------------------
'-- ADD ITEMS TO THE TYPE DROP DOWN BOX

'----------------------------------------------------------------------------
sqlCMD.Connection = New
SqlConnection(ConfigurationSettings.AppSettings("con"))
sqlCMD.CommandType = CommandType.StoredProcedure
sqlCMD.CommandText = "usp_GetAppType"

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
 
Ok when I take the application and database home and recomplie and run
it there, I can not enter any text in the drop down list control.
We'll be rebuilding our web server later today. I know that doesn't
tell me the problem, it should correct it.

Thanks everyone
 
Back
Top