/// <summary> /// Handles the SelectedIndexChanged event of the UsersGridView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void UsersGridView_SelectedIndexChanged(object sender, EventArgs e) { ProfileCommon profile = Profile.GetProfile(UsersGridView.SelectedDataKey.Value.ToString()); List <ProfileCommon> list = new List <ProfileCommon>(); list.Add(profile); UserDetailsView.DataSource = list; UserDetailsView.DataBind(); UserDetailsView.Visible = true; }
private void Bind() { //string CS = ConfigurationManager.ConnectionStrings["LMSConnectionString"].ConnectionString; //using (SqlConnection con = new SqlConnection(CS)) DataTable dt = DataBaseManager.GetEmployeeDataTable(); UserDetailsView.DataSourceID = null; UserDetailsView.DataSource = dt; UserDetailsView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string userName = Request.QueryString["user"]; UserInfo userObj = new UserInfo(); DataTable dt = new DataTable(); dt = userObj.GetUserInfo(userName); UserDetailsView.DataSource = dt; UserDetailsView.DataBind(); }
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(); }