Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Adding new items to the Ajax combobox control

$
0
0

Hello: I have a form that has an Ajai combobox control on it. This control, is populated by a dataset:

 

<%--     AJAX COMBO BOX CONTROL:--%><asp:ComboBox ID="ddCompanyName" DropDownStyle="Simple" AutoCompleteMode="Append" AppendDataBoundItems="true"  runat="server" TabIndex="1"  DataSourceID="SqlDataSourceCompanyName" DataTextField="companyname" DataValueField="companynameId" SelectedValue='<%# Bind("companyname")%>'><asp:ListItem Text="Select" Value="" /></asp:ComboBox><asp:RequiredFieldValidator ID="reqCompanyName" runat="server" ControlToValidate="ddCompanyName" InitialValue="" Display="None" SetFocusOnError="true" ErrorMessage="Please select or enter Customer Name." /></td><%--     END AJAX COMBO BOX CONTROL:--%>


And in addition to it being populated by a dataset, I wanted to add item "Select" so that it appears at the top of the list and displays when the page loads; In my code above, I attempted to do this by adding this line:

<asp:ListItem Text="Select" Value="" />

however, when the page loads, the combo box appears blank until you click on it; that's when you see all the values in the database and it places "Select" into the mix in alpha order.

How can I make it so that "Select" appears at the top of the items. Also, how can I make "Select" appear in the box when the page loads?

thank you for your help,

Proctor


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>