c# - ASP.Net MVC HTMLHelper with external HTML -
i saw tutorials on asp.net mvc htmlhelpers , included html directly sourcecode.
i want create reusable controls don't have write login view , parts of on , on again on next projects.
the best thing if write dll , place created user controls therein
some time ago wrote application angularjs , there directives , in them templateurl
. there similar in asp.net mvc ?
i using razor view engine , .net framework 4.0.
i know use partial views partial views seem not work in dlls
"the best thing if write dll , place created user controls therein" - can. there 1 little cheat makes work easily.
when writing html helpers, make sure change namespace system.web.mvc.html
.
if use tagbuilder
class shouldn't using html in c# code.
then if reference dll in project, should able access html helper razor view
you can use other namespaces, have have edit web.config file inside views folder , add reference namespace in <system.web.webpages.razor>
section. re-using referenced namespace, can save configuration hassles.
depending on how many projects , how many developers want share code between, consider build server product (my team used teamcity 2 years before needed pay licence). can produce own custom nuget packages, lets share (and manage updates) partial views, editor templates, html helpers , more.
Comments
Post a Comment