示例#1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (id != "")
        {
            string list = string.Empty;
            foreach (ListItem item in catelist.Items)
            {
                if (item.Selected)
                {
                    list += item.Value + ",";
                }
            }

            if (list == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务分类!');</script>");
            }
            else
            {
                BllShopUser bUer  = new BllShopUser();
                ModShopUser mUser = bUer.GetModel(id);
                mUser.CategoryId = list.TrimEnd(',');
                int i = bUer.Update(mUser);
                if (i > 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('修改成功!');layer_close();</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('修改失败!');</script>");
                }
            }
        }
    }