简体   繁体   English

如何在ajax组合框中键入文本

[英]how can type text in the ajax combo box

i added ajax combo box to my page, but i have 2 problems. 我在页面上添加了ajax组合框,但是有2个问题。

1- i can not type in that. 1-我不能输入。

2- when i type in that , it automatically find matched words. 2-当我输入时,它会自动找到匹配的单词。 for example when i type "j" , it finds "jack". 例如,当我键入“ j”时,它将找到“ jack”。

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs"  Inherits="_Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
    </head>
   <body>
<form id="form1" runat="server">
<div>

    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

    <asp:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="SuggestAppend" 
            DropDownStyle="DropDownList" 

              style="display: inline;">
        <asp:ListItem>masoud</asp:ListItem>
        <asp:ListItem>jack</asp:ListItem>
    </asp:ComboBox>

    </ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

Is your browser Firefox? 您的浏览器是Firefox吗? If so, you may have to change the MaxLength property of the ComboBox control to a value other than the default 0. 如果是这样,则可能必须将ComboBox控件的MaxLength属性更改为默认值0以外的值。

This link will show you how to use all of the ajax controls, look at the combo box one. 该链接将向您展示如何使用所有的ajax控件,请看一下组合框。 And you can see which one you need then. 然后您可以看到需要哪一个。

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx

That is a link to all of the ajax controls with samples. 这是带有示例的所有ajax控件的链接。

as @CallumHolden said.. if you will set the dropdownstyle property to dropdown rather than dropdownlist it will work. 如@CallumHolden所说..如果您将dropdownstyle属性设置为dropdown而不是dropdownlist,它将起作用。 this solved my problem as well. 这也解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM