自动填充复选框 [英] Autocomplete with checkboxes

查看:146
本文介绍了自动填充复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个文本框上带有复选框的自动完成列表,我也应该可以选中取消选中复选框,当我检查一个或多个复选框时,项目应该显示在逗号分隔的文本框中。我该怎么办?

有没有可用的用户控件?

I require an autocomplete list with checkboxes on a textbox ,also i should be able to check uncheck checkboxes and when i check a single or multiple checkboxes that items should be displayed in textboxes seperated by commas.How can I do this?
Is there any user control available?

推荐答案

<asp:TextBox ID="TextBox1" runat="server" Width="300px"></asp:TextBox>
        <asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="true"

            onselectedindexchanged="CheckBoxList1_SelectedIndexChanged">
        <asp:ListItem Value="1">ListItem1</asp:ListItem>
        <asp:ListItem Value="2">ListItem2</asp:ListItem>
        <asp:ListItem Value="3">ListItem3</asp:ListItem>
        <asp:ListItem Value="4">ListItem4</asp:ListItem>
        <asp:ListItem Value="5">ListItem5</asp:ListItem>
        </asp:CheckBoxList>







protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
    TextBox1.Text += CheckBoxList1.SelectedItem.Text+",";
}





试一试......这是最简单的实施,你必须做很多检查

喜欢

1.应该避免重复

2.取消选中它应该从文本框中删除而不是添加

ETC. ..





希望这有助于!!!



Try it... This is simplest implimentation you will have to do a lot of checking
like
1. duplicate should be avoided
2. on uncheck it item should be removed from textbox instead add
ETC...


Hope This Helps!!!


这篇关于自动填充复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆