• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

ASP.NET + GriedView + C# .... cannot select row in grid and get details

I have a gridview control (VS2005) on the web page and 3 text boxes below that. I have a class file that will get the Emp data (ID, NAme and City) from table Employees and return the dataset. This dataset is then binded to the grid. Upto this I got it. Now my problems:

1. I cannot select the row in the grid. Why? It is as if the grid has become read-only. Whereas in Winforms, I can move up and down in the grid with the mouse click. How do I achieve this in ASP.NET?

2. I want that when I click on any row in the grid, I should be able to retrieve the data from the data and display the data in the text box. How do I achieve this?

  • 2
2 Solutions
Ted BouskillSenior Software DeveloperCommented:
Winform grids and Web form grids are very, very, very different.  HTML does not have the complex client side functionality that windows forms have.  Therefore you have to build it in using Javascript or AJAX.

To be honest, you will find that building UI's in web applications is far more difficult and time consuming that windows forms.  Creating a fancy looking UI in web clients is easy, the hard part is complex UI functionality.

The website www.asp.net has some excellent examples of what can be achieved fairly easily with ASP.NET but there is limits.  For example, a modal dialog on the web doesn't really exist.

1. Winform controls and Web controls are quite different. There is no free navigation in web data grid as you can experience in web forms. To select any particular row, you have to edit your columns and add a CommandField control ("Select" in your case).

2. Again, you can override OnSelect for your CommandField as above and retrieve any data you need.

Ted BouskillSenior Software DeveloperCommented:
The following company has some good quality grids run with complex JavaScript but you have to tweak them a bit to get decent performance.  If the grids are too large they are exponentially slower.


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now