关于复选框列表 [英] About Check Box List

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

问题描述

亲爱的先生,

我正在开发Windows应用程序,这是一个小小的要求,首先,我将从复选框列表中的后端填充城市名称中获取城市名称,然后从该复选框列表中选择我需要存储在其中的项目后端.

例如:假设我从10个项目中选择5个项目(复选框),则需要在后端存储5个项目.

请提供有关如何使用c#.net在sql server 2005中插入多个复选框以及如何从后端将项目填充到前端的代码.


谢谢
Venkataramaiah

Dear Sir,

I''m developing windows application, in that one small requirement, Ist i''m getting city names from back end populating city names in the check box list,from that check box list what ever i select items i need to store in the back end.

Ex: Suppose if i select 5 items(Checkboxes) out of 10 i need to store five items in the back end.

Please provide the code for how to insert the multiple check boxes in the sql server 2005 by using c#.net and how to populate items to front end from back end.


Thanks
Venkataramaiah

推荐答案

迭代ListBox的所有项目,并检查是否选中了该项目.

Iterate all the Item of ListBox and check that that item is checked or not.

string citye=string.Empty;
foreach (ListItem item in CheckBoxList1.Items)
           {
               if (item.Selected)
                   city += item.Value + "


" ; }
"; }



如果您在表格中使用单列存储城市名称,则可以添加唯一的分隔符,例如



If you are using single column in your table to store city name you can add a unique separator e.g.


或#来串联城市名称. (请参见上面的代码示例)
or # to concatenate city name. (See above code sample)


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

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