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

后端 未结 7 2153
别那么骄傲
别那么骄傲 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:19

    I have tried with following code. it's working for me fine

    ManageOrder Order = new ManageOrder();
    Organization.DataSource = Order.getAllOrganization(Session["userID"].ToString());
    Organization.DataValueField = "OrganisationID";
    Organization.DataTextField = "OrganisationName";                
    Organization.DataBind();                
    Organization.Items.Insert(0, new ListItem("Select Organisation", "0"));
    

提交回复
热议问题