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:DropDownList ID="DropDownList1" runat="server"
DataSourceID="testSqlDataSource1"
DataTextField="Company_Name" DataValueField="Company_ID">
</asp:DropDownList><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,"");
[quoted text clipped - 5 lines]
>> data before user select it.
>> How can I do this.? Thanks
Alex D. - 14 Feb 2006 15:14 GMT
I would suggest to databind programatically instead of using the IDE.
otherwise I jus dont know how to do it ;-)
> 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
[quoted text clipped - 42 lines]
>>> data before user select it.
>>> How can I do this.? Thanks