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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:59:04+00:00 2026-06-03T15:59:04+00:00

I am very new to MVC3 and having problems wrapping my head around things.

  • 0

I am very new to MVC3 and having problems wrapping my head around things. Right now I have a partial view which I have simplified below:

@model blah.blah.blah.blah.ForumPost

@using (Html.BeginForm()) {

<fieldset>
    <legend>ForumPost</legend>

    <div class="editor-label">
        @Html.LabelFor(model => model.ForumID)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.ForumID)
        @Html.ValidationMessageFor(model => model.ForumID)
    </div>
    <p>
        <input type="submit" value="Create" />
        @Html.ValidationSummary(true)
    </p>
</fieldset>

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
}

I am not what to do for form validation. I have been trying to using jquery validation but I cant seem to find a good example that fits what I am doing and just get lost. I was basing it off this example here but it isn’t enough.

After I am done I want to call a method in some code and I am not really sure of a clean way to do this. The way I have it currently working is using an ajax call and it’s really ugly. Also a colleague suggested I pass the method an actual forum post but I don’t know how. The code for the method I want to call is below:

public void PostToForum(ForumPost post)
{
    UserService cu = new UserService();
    int PostUserID = cu.GetUserIDByUsername(base.User.Identity.Name);

    if (this.ModelState.IsValid)
    {
        ForumPost nfp = service.CreateForumPost(post);
    }
}

Anyone have some tips? Thanks.

I can provide more code if it’s necessary.

  • 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-03T15:59:07+00:00Added an answer on June 3, 2026 at 3:59 pm

    Html forms are usually submitted to controller actions:

    [HttpPost]
    public ActionResult Create(ForumPost model)
    {
        if (!ModelState.IsValid)
        {
            // validation failed => redisplay the view so that the user can fix the errors
            return View(model);
        }
    
        // at this stage the model is valid => process it:
        service.CreateForumPost(model);
    
        return ...
    }
    

    Now since this is a partial view you must be careful with the view you are returning from this controller action as well as the model. If you don’t use AJAX you should return the entire parent view and the parent view model. If you use an AjaxForm then you could only work with the partial model and view. Also in this case in the event of success you could return a Json result to the view to indicate this success so that the javascript handler that will be executed could take the respective actions.

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

Sidebar

Related Questions

All, I am very new to MVC3 / jQuery combo and have been reading
I'm playing around with using ASP.NET MVC3 and have a very simple site that
I'm a bit new to SSRS... I have an MVC3 application which I need
Very new to PHP5 and have some problems still. I figured out how to
In our new very large MVC3 application, we have a security problem to solve.
Right, I have been tasked with developing a new application in MVC3 that unfortunately
Very new to python and can't understand why this isn't working. I have a
Very new to C++ and Cocos2d-x but I was just toying around with CCArray
Very new to JQuery and MVC and webdevelopment over all. I'm now trying to
Im very new in C++ I have found this post http://msdn.microsoft.com/en-us/magazine/cc163486.aspx and trying to

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.