【问题标题】:Ajax combo box in gridview appends the value I searched with the data that is bound from the databasegridview 中的 Ajax 组合框将我搜索的值附加到从数据库绑定的数据中
【发布时间】:2012-07-20 05:33:27
【问题描述】:

gridview 中的 Ajax 组合框将我搜索到的值附加到数据库中绑定的数据

我不希望它附加或绑定在搜索中键入的值,在 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

例子

combo box has 

bat 
ball
bike

now if I type bajojiojwe

combo box would have

bat 
ball
bike
bajojiojwe

【问题讨论】:

    标签: asp.net ajax gridview combobox autosuggest


    【解决方案1】:

    那是因为你需要更改默认的下拉样式

    发件人:(默认值)

    DropDownStyle="DropDown"
    

    收件人:

    DropDownStyle="DropDownList"
    

    应用此更改后,您的用户将只能从 ComboBox 中选择值

    【讨论】:

    • 同样在下拉模式下,只有当我们按下组合框按钮时,组合框才会添加项目,如果我们按下回车按钮,那么它不会向组合框添加任何项目。
    • 是的。这就是为什么我建议使用:DropDownStyle=DropDownList。在这种模式下不会发生不良影响
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-11
    • 1970-01-01
    • 1970-01-01
    • 2012-12-28
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多