Exemple #1
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            GridView    gv  = (GridView)sender;
            GridViewRow row = GridView1.Rows[e.RowIndex];

            string       sUserName = gv.DataKeys[e.RowIndex]["TenDangNhap"].ToString();
            string       sNewPass  = ((TextBox)(row.Cells[1].Controls[0])).Text;
            string       sNewType  = ((TextBox)(row.Cells[2].Controls[0])).Text;
            string       sNewMail  = ((TextBox)(row.Cells[3].Controls[0])).Text;
            NguoiDungDTO ndDTO     = new NguoiDungDTO();
            ndDTO.Username = sUserName;
            ndDTO.Newpass  = sNewPass;
            ndDTO.LoaiND   = int.Parse(sNewType);
            ndDTO.Mail     = sNewMail;
            NguoiDungBUS.SuaThongTin(ndDTO);
            GridView1.EditIndex = -1;
            BindItemsList();
        }
        catch (Exception ex)
        {
            Response.Write("<script type='text/javascript'>"
                           + "alert('Có lỗi xảy ra. Vui Lòng điền đúng kiểu dữ liệu yêu cầu !!!');"
                           + "</script>");
        }
    }