protected void NewUser_Click(object sender, EventArgs e) { UserDetailsView.ChangeMode(DetailsViewMode.Insert); // SubscDetailsView.Visible = false; NewUser.Visible = false; SubscDetailsView.Visible = false; //sindex = UsersGridView.SelectedRow.RowIndex + 1; //((CommandField)UserDetailsView.Fields[0]).ShowInsertButton = true; }
protected void UserDetailsView_ModeChanging(object sender, DetailsViewModeEventArgs e) { if (UserDetailsView.CurrentMode == DetailsViewMode.ReadOnly) { UserDetailsView.ChangeMode(DetailsViewMode.Edit); UserDetailsView.DataBind(); } else { UserDetailsView.ChangeMode(DetailsViewMode.ReadOnly); } }
protected void UserDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { TextBox mobile = UserDetailsView.Rows[4].Cells[1].Controls[0] as TextBox; TextBox email = UserDetailsView.Rows[5].Cells[1].Controls[0] as TextBox; string address = UserDetailsView.Rows[6].Cells[1].Controls[0].ToString(); //as TextBox; CurrentUser.Employee.MobileNo = mobile.Text; CurrentUser.Employee.Email = email.Text; CurrentUser.Employee.Address = address; DataBaseManager.UpdateEmployee(CurrentUser.Employee); UserDetailsView.ChangeMode(DetailsViewMode.ReadOnly); UserDetailsView.DataBind(); }