private void LoadGride() { dgvUserList.Rows.Clear(); dgvUserList.Columns.Clear(); dgvUserList.Columns.Add("UserMasterID", ""); dgvUserList.Columns.Add("UserFullName", "User Full Name"); dgvUserList.Columns.Add("DateOFBirth", "DateOfBirth"); dgvUserList.Columns.Add("Emial", "Email Address"); dgvUserList.Columns.Add("Phone", "Phone Number"); dgvUserList.Columns.Add("UserID", "User Name"); dgvUserList.Columns.Add("AccountType", "Account Type"); dgvUserList.Columns.Add("Rating", "Rating"); dgvUserList.Columns["UserFullName"].Width = 150; dgvUserList.Columns["DateOFBirth"].Width = 100; dgvUserList.Columns["Emial"].Width = 100; dgvUserList.Columns["Phone"].Width = 100; dgvUserList.Columns["UserID"].Width = 120; dgvUserList.Columns["Rating"].Width = 70; dgvUserList.Columns["UserMasterID"].Visible = false; List <UserMasterDto> userList = new List <UserMasterDto>(); try { userList = UserMasterDao.GetAll(); } catch (Exception ex) { } if (userList.Count > 0) { for (int i = 0; i < userList.Count; i++) { dgvUserList.Rows.Add(); dgvUserList.Rows[i].Cells["UserMasterID"].Value = userList[i].UserMasterID; dgvUserList.Rows[i].Cells["UserID"].Value = userList[i].UserName; dgvUserList.Rows[i].Cells["UserFullName"].Value = userList[i].UserFullName; dgvUserList.Rows[i].Cells["DateOFBirth"].Value = userList[i].DateOfBirth.ToString("dd-MMM-yyyy"); dgvUserList.Rows[i].Cells["Emial"].Value = userList[i].Email; dgvUserList.Rows[i].Cells["Phone"].Value = userList[i].PhoneNumber; dgvUserList.Rows[i].Cells["AccountType"].Value = userList[i].AccountType; dgvUserList.Rows[i].Cells["Rating"].Value = userList[i].Rating; } } }
private void LoadGride() { dvgUserList.Rows.Clear(); dvgUserList.Columns.Clear(); dvgUserList.Columns.Add("UserMasterID", "Serial"); dvgUserList.Columns.Add("UserFullName", "Name"); dvgUserList.Columns.Add("Email", "Email"); dvgUserList.Columns.Add("Rating", "Rating"); dvgUserList.Columns["UserFullName"].Width = 150; dvgUserList.Columns["Email"].Width = 100; dvgUserList.Columns["Rating"].Width = 100; dvgUserList.Columns["UserMasterID"].Width = 50; List <UserMasterDto> userlist = new List <UserMasterDto>(); try { userlist = UserMasterDao.GetAll(); } catch (Exception ex) { } if (userlist.Count > 0) { for (int i = 0; i < userlist.Count; i++) { dvgUserList.Rows.Add(); dvgUserList.Rows[i].Cells["UserMasterID"].Value = i + 1; dvgUserList.Rows[i].Cells["UserFullName"].Value = userlist[i].UserName; dvgUserList.Rows[i].Cells["Email"].Value = userlist[i].Email; dvgUserList.Rows[i].Cells["Rating"].Value = userlist[i].Rating; } } }