I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
In this article, I will teach you, How to get cell value from dataGridView in windows form c#. First of all bind the dataGridView with any Data Source then you can access cell value from it. I bind it with many data source, check this link. In previous article, I get the cell value from selected row of dataGrid but on this time, we set the default row. In this article, I will give an example of cell click event.
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
decimal accno = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
MessageBox.Show(accno.ToString());
}
Here, Cells[0] return the first column's cell value from dataGridView.
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
decimal accno = Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
MessageBox.Show(accno.ToString());
}
Here, Cells[0] return the first column's cell value from dataGridView.
Comments
Post a Comment