Exemplo n.º 1
0
        protected void User_RowUpdate_Click(Object sender, GridViewUpdateEventArgs e)
        {
            // Retrieve the row that raised the event from the Rows

            GridViewRow row = modifyUser.Rows[e.RowIndex];


            //retrieve roll number from that row (key-non editable)
            int Userid = Convert.ToInt32(row.Cells[1].Text.ToString());
            //get the new values from that row
            string NewUsername = e.NewValues["username"].ToString();
            string NewPassword = e.NewValues["password"].ToString();
            string NewName     = e.NewValues["name"].ToString();
            string NewEmail    = e.NewValues["email"].ToString();
            string NewBdate    = e.NewValues["bdate"].ToString();
            string NewCountry  = e.NewValues["country"].ToString();
            string NewCellno   = e.NewValues["cellno"].ToString();

            Message.Text = Userid + NewUsername + NewPassword + NewEmail + NewBdate + NewCountry + NewCellno;

            //=====updating the newly entered values in database====
            enter obj    = new enter();
            int   result = obj.UpdateUsers(Userid, NewUsername, NewPassword, NewName, NewEmail, NewBdate, NewCountry, NewCellno);

            //reload the page======================================================
            modifyUser.EditIndex = -1;
            loadGrid();
            Message.Text = "UserID = " + Userid + "'s info updated";
        }