c# - Generic view in razor -


good morrow,

i learning razor, , found myself stuck in problem.

although know how use inheritance cshtml file actual class, "@inherits basiclistview<usermodel>", wanted have comodities of cshtml template engine, make base view, generic listing view, per instance.

i believe 1 might not able directly, cshtml cshtml, mark inheritance, quite ok, become class anyway.

as well, generate class myself , use it's object, may wrong, sounds little workaround me.

would care of having elegant solution it?

edit: redo question:

keeping in mind there strongly-typed view, per example list page, can think on how implement generic-typed view, same porpouse?

well, you're view either need work off common interface e.g.

@inherits basiclistview<imymodel> 

or use dynamic:

@inherits basiclistview<dynamic> 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -