How to set the default value of a Ajax combobox with a datasource to Null (empty)?

Posted on 2009-12-27
Medium Priority
Last Modified: 2012-05-08
Can somebody help me with the following problem?

I've Ajax combobox in mij aspx page wich is filled by a Datasource. But when i run this page I get default a value from the datesource.

I'll have only a empty Combobox at the begin.

This is my combobox and datasource.
            ID="cboStocknumber" runat="server" 
            AutoCompleteMode="SuggestAppend" DataSourceID="StocknumberDS" 
            DataTextField="StockNumber" DataValueField="StockNumber" MaxLength="0" 
            style="display: inline;" Width="200px">

<asp:SqlDataSource ID="StocknumberDS" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CWSConnectionString %>" 
            SelectCommand="SELECT [CustomerID], [StockNumber] FROM [CustomerStockNumber] WHERE ([CustomerID] = @CustomerID)">
                <asp:ControlParameter ControlID="cboCustomer" Name="CustomerID" 
                    PropertyName="SelectedValue" Type="Int32" />

Open in new window

Question by:prinsbj
1 Comment
LVL 21

Accepted Solution

tovvenki earned 2000 total points
ID: 26130229
How about inserting the default item from codebehind something like

cboStocknumber.Items.Insert(0, new ListItem("Select", "0"));

I do not have VS at present do could not test it. I am sorry for that.

Thanks and regards,

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question