WebForm中用checkbox的地方挺多的,下面写了几个简单的例子,方便以后学习使用。
PS:最近在做权限管理这个模块,发现用checkbox的地方挺多的,于是写了个简单的例子,以供以后学习和使用。
1.前端页面:
2.后台方法:#region 获取从前端页面回传过来的 CheckBox 的值 void GetCheckBoxValue()
///
/// 获取从前端页面回传过来的 CheckBox 的值
///
///
private void GetCheckBoxValue()
{
string user = Request["chk_per"];
string[] users = user.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
string s = string.Empty;
foreach (var item in users)
{
s += item + " | ";
}
}
#endregionprotected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
//测试调用
GetCheckBoxValue();
}
}
更多信息请查看IT技术专栏