1

Ajax combo box in gridview appends the value I searched with the data that is bound from the database

I dont want it to, append or bind the value that are typed in searched, this is happening when in gridview

<asp:TemplateField HeaderText="Supplier" ItemStyle-Width="30%">
           <ItemTemplate>

        <asp:ComboBox ID="ddlsup" runat="server" AutoCompleteMode="SuggestAppend"
      AutoPostBack="true" AppendDataBoundItems="false" CssClass="simpletxt">

           </asp:ComboBox>
    </ItemTemplat

example

combo box has 

bat 
ball
bike

now if I type bajojiojwe

combo box would have

bat 
ball
bike
bajojiojwe

1 Answer 1

2

That's because you need to change the default drop down style

From: (default value)

DropDownStyle="DropDown"

To:

DropDownStyle="DropDownList"

After applying this change, your users will only be able to select values from the ComboBox

2
  • also in dropdown mode the combox box add items only when we press the combo box button if we press the enter button then it does not add any item to the combo box. Jul 20, 2012 at 6:26
  • Yes. That's why I'm suggesting to use: DropDownStyle=DropDownList. In this mode that undesired effect doesn't occur
    – Jupaol
    Jul 20, 2012 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.