Quick and dirty GridView not working
I need to make a simple asp.net MVC project, which contains a GridView. I managed to get th开发者_如何学编程e gridview working, and showing actual data (I have an MS Access database set up), but it seems somehow I got something wrong: although everything shows up just fine, any buttons/links (like page updating, delete, edit, etc) don't do nothing. They just submit the form and refresh the page, but nothing is different.
Could you point me in the right direction? (although I couldn't find anything on google, I'm pretty sure this is a common newbie mistake)
Note: I know I didn't post any code, but I don't know exactly what code to post. If you need further information, please ask.
When you talk about GridView I hope you are not referring to GridView because that's not something you should be using in an MVC application.
If you are running MVC 3 you could use the WebGrid helper (which has some limitations) or MVCContrib Grid. There is also the Telerik Grid which is nice and worth looking at. You also have the possibility of a full client side javascript driven grid such as the jqGrid jquery Grid plugin.
The ASP.Net GridView will probably work much better for you in a conventional ASP.Net Web Site or Web Application project, which is different from an MVC application.
You have mixed the two kinds of web projects. You have to use MVC techniques in an MVC application, as Darin suggests.
If you are in a hurry and you don't mind changing from MVC to classic ASP.Net, you will probably be able to copy your code onto a new WebForm and get it working as you wish fairly quickly.
Otherwise, you will have to start over with a control intended for MVC.
I would recommend a jQuery Gridview. You can see one example here and you can see a blog post about it here.
精彩评论