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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:50:29+00:00 2026-06-01T01:50:29+00:00

I am doing big project in Web Forms and entered a big mess of

  • 0

I am doing big project in Web Forms and entered a big mess of code(can be solved with little refactoring), so I decided to take a peek at mvc, seems like everyone favores it over web forms.

I have dll file with all LINQ to SQL classes and methods for existing sql db and I started teaching myself by reacreating this project in mvc.I first recreated my homepage from webforms to razor, so far so good and I recreated one of the user controls to partial view and looped it.
Partial view is strongly typed with one of L2S class, the thing is there is some raw data in it.Like for example My model for partial view is my L2S class PostDetails: it consist od some data ready from output like: Title, Permalink, ViewsNumber etc. but it also cointains some raw data like UserId(I need to call method from dll to get username),DateTimeCreated(on which I also need to call method to get time difference), In webforms I would do this in codebehind but I’m not sure where to do it in mvc, maybe in controller and pass it in ViewData.I am also asking this for future, not just this case.

  • 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-06-01T01:50:31+00:00Added an answer on June 1, 2026 at 1:50 am

    You should perform those actions in the controller. The controller is exactly what it sounds like, it controls the data flow between the model and the view.

    Here is an example using your PostDetails:

    PostDetailsModel

    String Title {get;set;}
    String Permalink {get;set;}
    Int ViewNumber {get;set}
    Int UserId {get;set}
    DateTime DateTimeCreated {get;set;}
    

    GetDetailsView: this will be requested by your user, and will be a visual representation of the PostDetailsModel (however you want to format that). When this View is requested, a call is made to your controller….

    PostDetailsController

    //This method will (by default) come from calling [BASEURL]/PostDetails/GetDetails
    public ActionResult GetDetails()
    {
        var details = new PostDetailsModel();
        details.UserId = GetUserId();
        details.ViewNumber = GetViewNumber();
        ....
        //By default this looks for a view in the PostDetails folder 
        //by the name of your method (GetDetails)
        return View(details);
    }
    

    Notice how the controller is the router between the model and the view, basically. A note, however, it would be better to fill your model from methods contained within some sort of business layer (however you implement that). Something like var details = BL.GetDetails();

    Also, when the user makes requests to save data, then you can do that with another method that takes the data (whether it be the PostDetailsModel or an int or…) and does whatever it needs to do, then it can redirect back to the display action (or wherever you need it to go)

    There is a wealth of information on MVC with a simple google search. Here is Microsoft’s overview, but the wikipedia article is very succinct if you just want the basics

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently decided to take on a pretty big software engineering project that will
Recently I've been doing quite a big project with php + mysql. And now
I'm starting a Web Application project in Java and I've been doing some research
Possible Duplicate: Strict mode in PHP? I am doing a big project in PHP.
I am currently doing a big project (by big I mean, many processes) where
When doing larger sites in big business, you most probalbly work in a team
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
I have a pretty big web application that I created last year using ASP.NET
I've started working on a new web project with some friends... we are using

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.