如何从C#asp.net中的复选框列表中选择值 [英] How select values from checkbox list in C# asp.net

查看:121
本文介绍了如何从C#asp.net中的复选框列表中选择值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我有一个搜索应用程序,其中包含每个项目的项目和文本框的复选框列表日期和结束日期,核对表项目是从数据库动态绑定的,如果有更多的项目,那么有更多的复选框来,同时选择所有复选框并搜索项目(搜索按钮在那里)然后有很多往返过程正在进行在(3层应用程序)上花了很多时间来填充网格控件,是否有任何进程将整个复选框列表的数据和文本boxe的数据发送到数据库(存储过程)中进行单次往返并获取记录。



客户列表:客户1 StartDateTextBox EndatedateTextBox

客户2 StartDateTextBox EndatedateTextBox

客户3 StartDateTextBox EndatedateTextBox

客户4 StartDateTextBox EndatedateTextBox

客户5 Sta rtDateTextBox EndatedateTextBox

客户6 StartDateTextBox EndatedateTextBox

客户7 StartDateTextBox EndatedateTextBox



按钮搜索







GridVew结果:

Hi,


I Have a search application in which contains the checkbox list of projects and text boxes for each projects with start date and end date, checklist items are binding dynamically from the databse, if there more projects then there are more checkboxes coming, while selecting all check boxes and searching the item(Search Button is there) then there is lots of round trip process is going on(3-Tier Application) which taking lots of time to fill the grid control, Is there any process to send the whole checkbox list's data and text boxe's data into database(Stored procedure) in single roundtrip and fetch records.

Customer List:Customer 1 StartDateTextBox EndatedateTextBox
Customer 2 StartDateTextBox EndatedateTextBox
Customer 3 StartDateTextBox EndatedateTextBox
Customer 4 StartDateTextBox EndatedateTextBox
Customer 5 StartDateTextBox EndatedateTextBox
Customer 6 StartDateTextBox EndatedateTextBox
Customer 7 StartDateTextBox EndatedateTextBox

Button Search



GridVew Result:

推荐答案

而不是叫这个为每个选定的值重复调用的操作只是将所有选定的值连接成单个字符串,并使用该字符串参数对数据库进行一次调用。



然后获取通过这些参数分离和获取结果的值将通过存储过程完成。



Ex: -



你可以这样做

Rather than calling this operation to be called repeatedly for each selected value just make all the selected values concatenated into single string and make a single call to database with that string parameter.

Then to get values separating and fetching the result by those parameter will be done by stored procedure.

Ex :-

You can do like
|~|Customer1|#|StartDate1|#|EndDate1|~|Customer2|#|StartDate2|#|EndDate2|~|





在程序中你可以用'|〜|'和'|#|'字符串拆分它们以获得你想要的值用于过滤数据。



在这里你可以看到可以一次发送两组数据。



and in procedure you can split it by '|~|' and '|#|' strings to get your desired values to use for filtering data.

Here you can see two sets of data can be sent in one go.


这篇关于如何从C#asp.net中的复选框列表中选择值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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