Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 105105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:23:12+00:00 2026-05-11T01:23:12+00:00

I have developed a simple mechanism for my mvc website to pull in html

  • 0

I have developed a simple mechanism for my mvc website to pull in html via jquery which then populates a specified div. All is well and it looks cool.
My problem is that i’m now creating html markup inside of my controller (Which is very easy to do in VB.net btw) I’d rather not mix up the sepparation of concerns.

Is it possible to use a custom ‘MVC View User Control’ to suit this need? Can I create an instance of a control, pass in the model data and render to html? It would then be a simple matter of rendering and passing back to the calling browser.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:23:13+00:00Added an answer on May 11, 2026 at 1:23 am

    You have several options.

    Create a MVC View User Control and action handler in your controller for the view. To render the view use

    <% Html.RenderPartial('MyControl') %> 

    In this case your action handler will need to pass the model data to the view

    public ActionResult MyControl () {     // get modelData      render View (modelData); } 

    Your other option is to pass the model data from the parent page. In this case you do not need an action handler and the model type is the same as the parent:

    <% Html.RenderPartial('MyControl', ViewData.Model) %> 

    If your user control has it’s own data type you can also construct it within the page

    In MyControl.ascx.cs:

    public class MyControlViewData {     public string Name { get; set; }     public string Email { get; set; } }  public partial class MyControl : System.Web.Mvc.ViewUserControl <MyControlViewData> { } 

    And in your page you can initialize your control’s data model:

    <% Html.RenderPartial('MyControl', new MyControlViewData ()    {         Name= ViewData.Model.FirstName,         Email = ViewData.Model.Email,    });  %> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer QueryExpression doesn't support this. You'll need to use Fetch XML.… May 11, 2026 at 11:08 am
  • added an answer There is a subtle difference. If you specify a field… May 11, 2026 at 11:08 am
  • added an answer todd.run is totally right on, but that's only half the… May 11, 2026 at 11:08 am

Related Questions

I have developed a simple mechanism for my mvc website to pull in html
I have heard a few developers recently say that they are simply polling stuff
I have developed a VB.NET WCF service that recives and sends back data. When
I have developed a framework that is used by several teams in our organisation.
I have developed a build system on MSBuild (NET 3.0) and cc.net to perform
I have developed a couple of extensions for Firefox, and am annoyed that it
I have developed a business index which combines ecommerce websites.(in asp.net2.0+c#) I'm looking for
I am developing a web application which has Chart Controls. I have developed a
Over the years I have slowly developed a regular expression that validates most email
I have inherited a VB6/Access application that we have developed and sold for many

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.