www.webdeveloper.com
Results 1 to 2 of 2

Thread: Dynamic runtime-created DropDownList problem

  1. #1
    Join Date
    Mar 2007
    Location
    Egypt
    Posts
    65

    Dynamic runtime-created DropDownList problem

    Hi,

    I'm creating a drop down list at runtime, specifying the DataSourceID property to a SqlDataSource.
    I want to add a ListItem at the beginning of the DropDownList and have it as the selected item but nothing happens

    here's the code:
    Code:
                        Dim _ddl As DropDownList = New DropDownList()
                        _ddl.ID = "ddl" + iCounter2.ToString()
                        _ddl.DataSourceID = "RatingScalesSqlDataSource"
                        _ddl.DataTextField = "ScaleDescEn"
                        _ddl.DataValueField = "ScaleID"
                        Dim emptyListItem As ListItem = New ListItem("--Select--", "")
                        _ddl.Items.Add(emptyListItem)
                        _ddl.Items.FindByValue("").Selected = True
    Thanks in advance

  2. #2
    Join Date
    Mar 2007
    Location
    Egypt
    Posts
    65
    No suggestions?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles