4

Is the MVC WebGrid Open Source? If so where can I find the source code.

The current version of the WebGrid has little to no documentation, incomplete implemtation etc.

I am trying to do a simple thing as adding a visibility property to the WebGrid.Column() in the view, but that is impossible

Tawani
  • 11,067
  • 20
  • 82
  • 106

1 Answers1

7

You can download the source code of ASP.NET MVC 3 and inside you have the source of WebGrid. Once you unzip you will find it inside the webpages/src/System.Web.Helpers/WebGrid/WebGrid.cs file.

Good luck with modifying it :-) (1104 lines in a single source code file)

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Not 100% correct. Surely Tawani can get the code (and probably that's his major concern). But the Microsoft Source License doesn't really meet the "open" source definition, so the answer to the question, literally interpreted, should be no. In this case, as again I think his major concern is to get the code (and maybe debug) then it's enough "open" for the author's needs. – usr-local-ΕΨΗΕΛΩΝ Mar 23 '11 at 18:32
  • 1
    @Darin, do you usually use that control or do you build your own custom grids? – The Muffin Man Mar 23 '11 at 18:32
  • 6
    @Nick, I don't use this control. I hate this control. This control relies on magic strings (dynamic fields). This control is hopeless. I don't build my own custom grids: that would be insane especially when we have things like MVCContrib Grid or Telerik Grid. – Darin Dimitrov Mar 23 '11 at 18:35
  • @djechelon, good remark, I've updated my answer. Thanks for pointing this out. – Darin Dimitrov Mar 23 '11 at 18:35
  • @Darin, ha, so I'm guessing it's the same scenario as the webforms GridView? I always write my own code, rather than extending it. – The Muffin Man Mar 23 '11 at 18:38
  • 1
    @Nick, it's been ages I haven't touched at WebForms :-) All I can remember about it is that I hated it :-) – Darin Dimitrov Mar 23 '11 at 18:44
  • @Darin, Yes there is many aspects that I don't like, but not having to handle form posts is convenient, plus the fact that url routing works in it is nice. – The Muffin Man Mar 23 '11 at 18:58
  • @Darin, I tried substituting the MvcContrib Grid for the WebGrid in the app I'm working on. Result: Better syntax, fewer workarounds, and no ugly dynamic typing. Thanks for the recommendation! – Ryan Lundy May 11 '11 at 22:41