How to add a default “Select” option to this ASP.NET DropDownList control?

后端 未结 7 2154
别那么骄傲
别那么骄傲 2021-01-02 05:06

I am a new ASP.NET developer and I am trying to learn Linq-To-Entities. I am trying to bind a DropDownList with the Linq statement for retrieving the list of status in the S

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 05:30

    Move DropDownList1.Items.Add(new ListItem("Select", "0", true)); After bindStatusDropDownList();

    so:

        if (!IsPostBack)
        {
            bindStatusDropDownList(); //first create structure
            DropDownList1.Items.Add(new ListItem("Select", "0", true)); // after add item
        }
    

提交回复
热议问题