griegs
griegs

Reputation: 22770

MVC User Controls in Standard ASP.Net

This may be a rookie question but if I have created a suite of user controls in MVC, can I reuse them in non MVC projects?

The reason I ask is because where I work we have multiple projects and not all of them can or will be converted but I'd like to show the powers that be that anything I do in MVC, with user controls, can be reused in other areas of the business.

Upvotes: 1

Views: 225

Answers (1)

mberube.Net
mberube.Net

Reputation: 2180

It's a bit difficult because ASP.NET doesn't use the same technic to render the controls on the page.

If your MVC control on generate html markup and isn't strongly bind to a particular model, the best I can see is to wrap your mvc control into an ASP.NET HtmlGenericControl and initialise the InnerHtml value with the Html string returned by your MVC control.

I hope it will help.

Upvotes: 1

Related Questions