在AJAX Toolkits中有个ListSearch扩展功能,其主要用于DropDownList和ListBox
当用户输入信息之后,其会对此进行定位查询。其属性如下:
- PromptText - 在对应控件的上方显示的初始信息,默认为'Type to search'. 当用户输入信息之后,该信息将会被用户实际输入的信息替代。注意,在布局该控件的时候,上方应留下部分距离
- PromptCssClass - 弹出信息的CssClass.
- PromptPosition - 弹出信息的位置,默认为TOP,这里还有Buttom选项。如果控件是DropDownList,应保证为TOP;如果是ListBox则两者都可以。
- Animations - Generic animations for the ListSearch extender. See the Using Animations walkthrough and Animation Reference for more details.
- OnShow - The OnShow animation will be played each time the extender's prompt is displayed. The prompt will be positioned correctly but hidden. The animation can use <HideAction Visible="true" /> to display the prompt along with any other visual effects.
- OnHide - The OnHide animation will be played each time the extender's prompt is hidden.
- 这个属性我没有使用,太复杂了
代码示例
Code
1<asp:Panel ID="Panel1" runat="server" Width="400px">
2 <asp:DropDownList ID="DropDownList1" runat="server">
3 <asp:ListItem>Mike</asp:ListItem>
4 <asp:ListItem>Lusia</asp:ListItem>
5 <asp:ListItem>Sandra</asp:ListItem>
6 <asp:ListItem>zura</asp:ListItem>
7 <asp:ListItem>Ronaldo</asp:ListItem>
8 <asp:ListItem>Giggs</asp:ListItem>
9 <asp:ListItem>Van Der Sa</asp:ListItem>
10 <asp:ListItem>Alex</asp:ListItem>
11 <asp:ListItem>Flecher</asp:ListItem>
12 <asp:ListItem>Kim Don Gou</asp:ListItem>
13 <asp:ListItem>Kim 1111</asp:ListItem>
14 <asp:ListItem>Kim 22221</asp:ListItem>
15 <asp:ListItem>Kim 3333</asp:ListItem>
16 <asp:ListItem>Kim 44441</asp:ListItem>
17 </asp:DropDownList>
18
19 <cc1:ListSearchExtender ID="DropDownList1_ListSearchExtender" runat="server"
20 Enabled="True" TargetControlID="DropDownList1" PromptText="Search" Animations="">
21 </cc1:ListSearchExtender>
22
23 </asp:Panel>
1<asp:Panel ID="Panel1" runat="server" Width="400px">
2 <asp:DropDownList ID="DropDownList1" runat="server">
3 <asp:ListItem>Mike</asp:ListItem>
4 <asp:ListItem>Lusia</asp:ListItem>
5 <asp:ListItem>Sandra</asp:ListItem>
6 <asp:ListItem>zura</asp:ListItem>
7 <asp:ListItem>Ronaldo</asp:ListItem>
8 <asp:ListItem>Giggs</asp:ListItem>
9 <asp:ListItem>Van Der Sa</asp:ListItem>
10 <asp:ListItem>Alex</asp:ListItem>
11 <asp:ListItem>Flecher</asp:ListItem>
12 <asp:ListItem>Kim Don Gou</asp:ListItem>
13 <asp:ListItem>Kim 1111</asp:ListItem>
14 <asp:ListItem>Kim 22221</asp:ListItem>
15 <asp:ListItem>Kim 3333</asp:ListItem>
16 <asp:ListItem>Kim 44441</asp:ListItem>
17 </asp:DropDownList>
18
19 <cc1:ListSearchExtender ID="DropDownList1_ListSearchExtender" runat="server"
20 Enabled="True" TargetControlID="DropDownList1" PromptText="Search" Animations="">
21 </cc1:ListSearchExtender>
22
23 </asp:Panel>