Asp.net - Add blank item at top of dropdownlist

后端 未结 10 1821
甜味超标
甜味超标 2020-11-30 20:03

Why is the dropdown not showing my blank item first? Here is what I have

drpList.Items.Add(New ListItem(\"\", \"\"))

With drpList
    .DataSource = myContro         


        
10条回答
  •  臣服心动
    2020-11-30 20:24

    You could also have a union of the blank select with the select that has content:

    select '' value, '' name
    union
    select value, name from mytable
    

提交回复
热议问题