.NET关于Repeater如何遍历里面的CheckBox,并且怎么获取每一列的值!(三张表的)
2012-09-12 10:31
471 查看
SuperRoles.Model.SuperRoles_UesrRoles user = new SuperRoles.Model.SuperRoles_UesrRoles();
string companyid = Request.QueryString["companyid"];
string name = Request.QueryString["UserName"];
foreach (Control item in this.rep_user.Controls)
{
CheckBox ck = (CheckBox)item.FindControl("isckture");
TextBox tbx = (TextBox)item.FindControl("tbxTableName");
TextBox tbid = (TextBox)item.FindControl("guid");
string role = tbx.Text;
Guid id = Guid.Parse(tbid.Text);
if (ck != null)
{
if (ck.Checked)
{
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().SelectByUserNameAndId(name, id, role))
{
MessageBox.ShowAndRedirect("修改权限成功", "CompanyMember_List.aspx");
}
else {
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().Insert(companyid, id, name, role))
{ MessageBox.ShowAndRedirect("添加用户角色成功", "CompanyMember_List.aspx");
}
}
} else {
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().Delete(id, name))
{ MessageBox.ShowSlideSuccess("修改权限成功");
} } } else
{ MessageBox.ShowSlideError("删除用户全部角色"); }
} }
public void SelectByName()
{
string name = Request.QueryString["UserName"];
foreach (Control item in this.rep_user.Controls)
{
TextBox tbx = (TextBox)item.FindControl("tbxTableName");
TextBox tbid = (TextBox)item.FindControl("guid");
string role = tbx.Text;
Guid id = Guid.Parse(tbid.Text);
CheckBox ck = (CheckBox)item.FindControl("isckture");
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().SelectByUserNameAndId(name, id, role))
{ ck.Checked = true; } }
} } }
string companyid = Request.QueryString["companyid"];
string name = Request.QueryString["UserName"];
foreach (Control item in this.rep_user.Controls)
{
CheckBox ck = (CheckBox)item.FindControl("isckture");
TextBox tbx = (TextBox)item.FindControl("tbxTableName");
TextBox tbid = (TextBox)item.FindControl("guid");
string role = tbx.Text;
Guid id = Guid.Parse(tbid.Text);
if (ck != null)
{
if (ck.Checked)
{
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().SelectByUserNameAndId(name, id, role))
{
MessageBox.ShowAndRedirect("修改权限成功", "CompanyMember_List.aspx");
}
else {
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().Insert(companyid, id, name, role))
{ MessageBox.ShowAndRedirect("添加用户角色成功", "CompanyMember_List.aspx");
}
}
} else {
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().Delete(id, name))
{ MessageBox.ShowSlideSuccess("修改权限成功");
} } } else
{ MessageBox.ShowSlideError("删除用户全部角色"); }
} }
public void SelectByName()
{
string name = Request.QueryString["UserName"];
foreach (Control item in this.rep_user.Controls)
{
TextBox tbx = (TextBox)item.FindControl("tbxTableName");
TextBox tbid = (TextBox)item.FindControl("guid");
string role = tbx.Text;
Guid id = Guid.Parse(tbid.Text);
CheckBox ck = (CheckBox)item.FindControl("isckture");
if (new SuperRoles.BLL.SuperRoles_UserInRoles_BLL().SelectByUserNameAndId(name, id, role))
{ ck.Checked = true; } }
} } }
相关文章推荐
- 关于Repeater如何获取控件对象
- **关于jquery如何获取checkbox,radio,select option的 值**
- 关于页面上如何获取用户选中的多个checkbox所传递的值
- FindFile FindNextFile 如何遍历一个文件夹并获取里面文件的信息
- DataList checkbox status,checkbox入在datalist的itemtemplte,并且这个datalist放在formview中,我该如何获取checkbox的状态?
- Visual Studio 2017中使用正则修改部分内容 如何使用ILAsm与ILDasm修改.Net exe(dll)文件 C#学习-图解教程(1):格式化数字字符串 小程序开发之图片转Base64(C#、.Net) jquery遍历table为每一个单元格取值及赋值 。net加密解密相关方法 .net关于坐标之间一些简单操作
- 关于jquery遍历已选中的checkbox事件,获取其值,批量进行删除
- asp.net关于如何删除repeater里面的记录
- 一起谈.NET技术,关于Winform下,获取Treeview中CheckBox选中项的技巧
- .net如何从后台获取repeater中的控件值
- 如何获取Repeater中checkbox的值
- 关于.net多层架构的网站如何在底层类库中获取网站的物理路径
- 你们帮我看看如何在datalist里面使用session获取ID值代码改怎么写啊麻烦了
- 关于 listview里面有EditText,然后想改变editText的值并且可以获取
- 关于Winform下,获取Treeview中CheckBox选中项的“.NET研究”技巧
- 再Repeater模板中,如何获取里面的控件 客户端ID ??
- .Net GridView 应用:Gridview有一个CheckBox列,在用了分页的情况下,如何取出用户选择的所有记录id
- .net如何向csv添加一列
- 如何获取CheckBoxList中的value值
- 关于获取.net,winform应用程序主窗体问题