如何在asp.net自动完成文本框中使用分号分隔文本框中的多个值

本文关键字:文本 分隔 net asp | 更新日期: 2023-09-27 18:11:33

我有一个文本框与自动完成扩展器,它的工作很好。如何通过用分号(;)分隔第一个值来允许用户输入多个值

<asp:TextBox ID="txt_to" runat="server" />
 <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txt_to"
 MinimumPrefixLength="2" CompletionInterval="10" EnableCaching="true" FirstRowSelected="true" CompletionSetCount="3" UseContextKey="True" ServiceMethod="GetCompletionList" />

如何在asp.net自动完成文本框中使用分号分隔文本框中的多个值

正如这里的演示页面所解释的,您应该使用DelimiterCharacters属性:

<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
    TargetControlID="txt_to" MinimumPrefixLength="2" CompletionInterval="10"
    EnableCaching="true" FirstRowSelected="true" CompletionSetCount="3"
    UseContextKey="True" ServiceMethod="GetCompletionList"
    DelimiterCharacters=";" />