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

  • SEARCH
  • Home
  • 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 8864957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:23:04+00:00 2026-06-14T16:23:04+00:00

My one view page I passed in a model through the controller, so I

  • 0

My one view page I passed in a model through the controller, so I can write:
@Html.DisplayFor(m => m.FirstName) which displays the First Name of the model. When I try to submit the form on the page using

@using (Html.BeginForm("CreateUser", "Controller", FormMethod.Post, new { UserViewModel = Model }))

and I take a look at my model in

[HttpPost]
public virtual ActionResult CreateUser(UserViewModel model)
{
    //model.FirstName is blank

Is there anyway I can make the model.FirstName not blank? by some how passing the model that I originally passed? I could set a bunch of hidden remarks, though if there is a better way that would be very helpful

EDIT: the DisplayFor is just an example to show the model is accessible. I actually have about 15 fields, and I am going through multiple forms trying to populate the model. Is Hidden the only way? and could I just hide the entire model?

  • 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-14T16:23:06+00:00Added an answer on June 14, 2026 at 4:23 pm

    @Html.DisplayFor() creates a simple literal with the value by default (if you’re not using a display template), on submit only form elements being submitted to the server.

    You can use hidden input.

    @Html.HiddenFor(m => m.FirstName)
    

    Which will be something like:

    <input type="hidden" value="{the first name}" name="FirstName" id="FirstName" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added one view controller to my first view controller as aa subview
I have implemented horizontal page view. One base page and three swipe pages. The
If you have several view models on one page, how do you ensure that
I have senario in which one view and view has binding with multiple ViewModel.
I have an integer variable ( time ) in one view controller whose value
Following this tutorial http://johnsquibb.com/tutorials/mvc-framework-in-1-hour-part-one Im trying to write my first MVC Blog. I understood
I have one (razor) page that contain 5 different partial views. Each partial view
I have a page that displays multiple Formsets, each of which has a prefix.
How would I have one view up when the iPhone is in a standard
In my application I want to have one view that holds 2 partial views.

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.