Results 1 to 4 of 4

Thread: ddl in asp.net

  1. #1

    Thread Starter
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    ddl in asp.net

    When I load a drop down list it automatically selects the first value
    in the list. I tried doing this:

    Me.ddlCustomers.SelectedIndex=-1

    hoping it would make sure nothing is selected and that didnt work.
    I just want to make sure the user selects something so that the combo box triggers the ChangeSelectedIndex event. Right now if it has a value it doesnt run that code.

    I want the combo boxes to have nothing selected at first.

    I tried searching google with very little info .

    Thanks,

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    After you bind the data or whatever, add a new item at index 0 that is just a space.

    ..databind code...

    DropDownList1.Items.Insert(0, new ListItem(" ", "-1"));

  3. #3

  4. #4

Posting Permissions

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



Click Here to Expand Forum to Full Width