dropdown lists, help adding

Results 1 to 2 of 2

Thread: dropdown lists, help adding

  1. #1
    Join Date
    Dec 1969

    Default dropdown lists, help adding

    hey all, im populating a dropdown list from a database, and am adding a "please select one" to the top of each list. the problem is i dont know how to add a value to "please select one" any help would be appreciated<BR>[code language="VB.NET"]<BR>Private Sub drpOrganization_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles drpOrganization.SelectedIndexChanged<BR> <BR> &#039; call to the osddll to populate the division dropdown list <BR> drpDivision.DataSource = OSD.Populate_Division(drpOrganization.SelectedValu e)<BR> &#039; assign values to text and value fields<BR> drpDivision.DataTextField = "division"<BR> drpDivision.DataValueField = "div_id"<BR> &#039; bind the dataset to the control<BR> drpDivision.DataBind()<BR> &#039; add a header to dropdowns<BR> drpDivision.Items.Insert(0, "Select an Item")<BR> drpDivision.SelectedIndex = 0<BR>[/code]

  2. #2

    Default RE: dropdown lists, help adding

    Create a new ListItem and set it&#039;s text and value, then add the list item instead of just the text.<BR><BR>drpDivision.Items.Insert(0, theNewLI);<BR>

Posting Permissions

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