简体   繁体   中英

Asp.Net MVC Property Grid Replacement

I'm currently migrating an old forms application for MVC. The forms application has a property grid, which automatically binds to an object. The object has [Category] attributes assigned to each property. The object is also very complex.

Is it better to build the View for this from scratch or use reflection to generate the UI. Personally, I prefer to build it using HTML, but the object is very big. If it is still preferable to build the entire UI using @Html.TextBoxFor(), then that's the way I'll do.

Also, I might end up creating a ViewModel for this, but that's a maybe.

Thanks!

It depends! Do you have many similar objects that can benefit from reflection? Is that code is going to be reused many times over in different views? If yes, do reflection.

Otherwise path down reflection will take you more time to work out. And given that you already have required html, just use it! Keep it simple.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM