Sorry, I'm new to this. I put it in test.aspx.cs but it doesn't work.
Could you take a look at the following code to see where I should put
this? Regards
test.aspx.cs::
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.Insert(0, "");
}
}
test.aspx:
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp
ropDownList ID="DropDownList1" runat="server"
DataSourceID="testSqlDataSource1"
DataTextField="Company_Name" DataValueField="Company_ID">
</asp
ropDownList><asp:SqlDataSource ID="testSqlDataSource1"
runat="server" ConnectionString="<%$
ConnectionStrings:kConnectionString %>"
SelectCommand="SELECT [Company_Name], [Company_ID] FROM
[Companies]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
after you databind do this:
this.DropDownList1.Items.Insert(0,"");