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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:45:25+00:00 2026-05-16T21:45:25+00:00

When I create a form to send data about new message: <% using (Html.BeginForm())

  • 0

When I create a form to send data about new message:

<% using (Html.BeginForm()) { %>                            

    <%= Html.TextAreaFor(m => m.Message.Text) %>

    <input type="submit" />

<% } %>

I can’t receive the message class in the controller:

[HttpPost]
public ActionResult NewMessage(Message message) // will not work, message is null

Instead I have to use the model class that’s passed to the view and then get the child class from it

[HttpPost]
public ActionResult NewMessage(NewMessageModel model) {
    Message message = model.Message;

And only after that I can do validation stuff.

Is there a way to pass a certain object to the controller?

  • 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-16T21:45:26+00:00Added an answer on May 16, 2026 at 9:45 pm
    public ActionResult NewMessage([Bind(Prefix="Message")]Message message)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code to create new form instance of a closed form using form name I
i create a new form using the code below. private void CNPictureBox2_DoubleClick(object sender, EventArgs
How can I create a form in ASP.NET MVC2, send the data to a
I need to send some HTML form data to a python script for formatting
i create one button in html <input type=button value=Simulate class=submit_btn id=stimulate /> and use
I think its easy to create form via only html and do not use
I want to create a form using an unordered list ul must have only
I have a problem while I need to send data using uploadify script. For
I create view for register and send data to controller //app::import('Model','Myprofile'); Class MembersController extends
I am using this code to make the user input a name to create

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.