您的位置:首页 > 其它

.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; } }

} } }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐