用于多选的asp.net控件(全选) [英] asp.net contol for multiple selection(select all)
本文介绍了用于多选的asp.net控件(全选)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
那里有程序员,我正在asp.net/vb.net开发一个系统。我想在表中插入批量记录,因此我想要一个asp.net控件,它将选择所有记录(在绑定之后),以便我可以在插入到sql语句中使用它。 dropdownlist控件是否支持所有记录的选择,我知道它支持多个选择,但我想要选择所有记录。
任何想法都可以做到这一点
Hi programmers there, am developing a system in asp.net/vb.net. I want to insert bulk records in a table hence i want an asp.net control that will select all records(after binding it)so that i can use it in an insert into sql statement. Does dropdownlist control support selection of all record, i know it support multiple selection but i want all records to be selected.
Any idea of a control that can do this
推荐答案
你可以有一个类似的控件: Web应用程序的多选下拉列表 [ ^ ] - 您可以在项目顶部添加一个全选选项。
You can have a control similar to: Multiselect Dropdown for Web Applications[^] - you can add one option of ''select all'' at the top of items.
我使用带有do while循环的列表框
Dim
i As整数= 0
虽然我< ListBox1.Items.Count
SetSelection(
True)
commandString =
INSERT INTO xt(b)VALUES(''+ listBox.items()。Tostring()+' ');
con.ConnectionString =
数据源= .\SQLEXPRESS; AttachDbFilename = | DataDirectory | \ simple.mdf; Integrated Security = True; User Instance = True
con.Open()
cmd.Connection = con
cmd.CommandText = commandString
DisplayMessage (
记录成功添加)
cmd.ExecuteNonQuery()
DisplayMessage(
未添加记录)
con.Close()
System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
结束时
i used a listbox with a do while loop
Dim
i As Integer = 0
While i < ListBox1.Items.Count
SetSelection(
True)
commandString =
"INSERT INTO xt (b) VALUES(''"+listBox.items().Tostring() +"'' );"
con.ConnectionString =
"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\simple.mdf;Integrated Security=True;User Instance=True"
con.Open()
cmd.Connection = con
cmd.CommandText = commandString
DisplayMessage(
"Records Added Successfully")
cmd.ExecuteNonQuery()
DisplayMessage(
"Records NOT Added")
con.Close()
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
end while
这篇关于用于多选的asp.net控件(全选)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文