1

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 Yeah I'm right with you hence the question. I was hoping I could inherit from X and get it to work. I don't much like the idea of a wrapper for a generic control as it complicates the model and reusability somewhat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.