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 379819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:55:43+00:00 2026-05-12T14:55:43+00:00

In traditional ASP.NET Web Form applications, UserControls are a great way to encapsulate functionality

  • 0

In traditional ASP.NET Web Form applications, UserControls are a great way to encapsulate functionality so that it can be reused. However, UserControls don’t fit well into the MVC model. They often make heavy use of ViewState and they blur the seperation of concerns that MVC promotes.

My question is, how do you best bundle a piece of functionality so it can be shared across MVC applications?

As an example, consider a from/to date-selector UserControl that:

  • allows a user to select two dates, either using a javascript overlay or by typing in day, month and year into seperate fields
  • can be configured to default to either today and tomorrow’s dates or to dates of the developer’s choosing
  • validates the dates that comes back from the user to ensure the from date is before the to date
  • exposes From and To properties that can be accessed by code-behind

How would I best build something like this in .NET MVC so that I can easily reuse it?

Note that to fully emulate User Control’s functionality the MVC component would have to manage the submitted form data and validation – not just the presentation.

  • 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. Editorial Team
    Editorial Team
    2026-05-12T14:55:44+00:00Added an answer on May 12, 2026 at 2:55 pm

    In general I would agree that user controls are nice in terms of encapsulating UI stuff, but I don’t think too much has really changed in MVC. If I remember right re-using user controls across classic Asp.net projects was a pain and was never really the best way to truly create reusable components. Most UI toolkits that you bought for classic ASP.net didn’t give you user controls, they gave you essentially server controls and javascript controls.

    In your example, I would probably create or find a jquery (or ur framework of choice) plugin that did what you wanted on the client side. You could also build a C# wrapper around it similar to what Telerik did with some of the jquery UI controls. I do think that the word code-behind and even viewstate will disappear from your vocabulary the more you get into MVC.

    If you look at what open source projects are out there for MVC you will get your answer in terms of what you should be doing.

    • The MVC Contrib app adds a lot of features by creating extension methods and helpers. Their grid control is a typical way to create a reusable component that you could use across projects

    • Telerik, created some extensions that wrap jquery controls and do asset management.

    • Finally I think if you look to the future, MVC has areas, which if I interpret it right will give you the ability to break your project apart into multiple smaller projects.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 257k
  • Answers 257k
  • 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
  • Editorial Team
    Editorial Team added an answer Why do we have requirements documents and design documents? To… May 13, 2026 at 10:51 am
  • Editorial Team
    Editorial Team added an answer Realised it's been a while since I posted this, however… May 13, 2026 at 10:51 am
  • Editorial Team
    Editorial Team added an answer Set your logging leven to "TRACE". In your log4j.properties (assuming… May 13, 2026 at 10:51 am

Related Questions

I am using System.Web.Routing in the Asp.Net Webform Application. I wrote the following route
I'm writing my first ASP.NET web application containing Master Pages. However, even though I
In this very simple ASP.NET application, Visual Web Developer 2008 Express CAN debug the
I have a problem when updating the source of an ASP ListBox in an

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.