asp.net mvc dynamic render partials
I'm working on an asp.net mvc project, I have a request to render html controls dynamically based on the data type from db,
for example: i have 2 record in db; id | type开发者_开发知识库 | value =========================== 1 | charactor | 1 2 | number | 2in the html side, i want generate these 2 controls differently, for the first record i want to generate as input text, and the second record i want to generate as dropdownlist, so my solution is create 2 partial views, and based on the type, i will use "renderpartial" to render different partials.
i like to know if there is any better solutions than this one? i found this solution caused slow performance.you may use editorfor templates.
http://bradwilson.typepad.com/blog/2009/10/aspnet-mvc-2-templates-part-1-introduction.html
精彩评论