获取复选框值 asp.net

来源:百度知道 编辑:UC知道 时间:2024/09/23 04:59:06
代码如下,我在父页里定义了个公共属性chkbox,然后通过子页引用其选中的值,但是只能显示出checkboxlist里一项的值,而不能显示我选中的多项值,肯定是return语句后没写对,我是新手,望高手帮忙解决!多谢了
public string chkbox
{
get
{
return CheckBoxList1.?
}
}

<input name="C" value="1" type="checkbox" />
<input name="C" value="2" type="checkbox" />
<input name="C" value="3" type="checkbox" />
<input name="C" value="4" type="checkbox" />
<input name="C" value="5" type="checkbox" />

void info()
{
try
{
_objid = Request["C"].ToString();
}
catch { }
}

protected void Button1_Click(object sender, EventArgs e)
{
string[] _ids = _objid.Split(',');
int i = 0;

for (i = 0; i < _ids.Length; i++)
{
Response.Write(_ids[i]);
}

}