Is there a generic Html.Element?
I would like to be able to do this:
Html.Element<AccountController>("IFrame", "elementName", new { src = c => c.ChangePassword })
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The most appropriate, “MVC-ish” approach to build HTML content the way you’re describing is to create a custom HtmlHelper extension method. This method ought to make use an instance of System.Web.Mvc.TagBuilder to construct the HTML. Here’s an example (copied from one of my current projects, but not actually tested in isolation):
As for extending your custom HtmlHelper method to support the controller action lambda, this post is a good place to start.