ASP中的复选框错误 [英] Checkbox error in ASP
本文介绍了ASP中的复选框错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为了显示多个复选框,我使用了带有中继器控件的单个复选框.
但是如何将所选的值存储在数据库中.
像
For displaying multiple Checkbox I used single checkbox using repeater control.
But how can I store that selected value in database.
Like
string prefJobCat1 = lbcategory.SelectedValue ;
我可以在lbcategory.selectedvalue
处使用什么,因为这行会产生错误.
根据转发器,我可以使用什么?
plz 请帮助我.
What can I use at the place of lbcategory.selectedvalue
beause at this line it gives error.
According to repeater what can I use ?
plz Please help me.
推荐答案
检查此代码是否有帮助:
Check if this code helps:
foreach (RepeaterItem test in repTest.Items)
{
CheckBox cBox = (CheckBox)test.FindControl("cbSelect");
if (cBox.Checked)
{
string prefJobCat1 += cBox.Text;
prefJobCat1 += ",";
}
}
这篇关于ASP中的复选框错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文