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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T07:03:31+00:00 2026-05-17T07:03:31+00:00

Hey all I am attempting to learn MVC 2 and ASP etc through the

  • 0

Hey all
I am attempting to learn MVC 2 and ASP etc through the MVC Music Store. At the same time I am attempting to conform what it is doing to a solution I am developing at work. The overall structure is an IT Help Desk ticket system and I am working on the very broad admin functions of creating, editing, and deleting tickets. I have followed the tutorial very closely but have hit a brick wall, when attempting to use values that should be getting posted to controller methods, and theyre not getting there.

For the create section my create.aspx looks like

<h2>Create</h2>
<% Html.EnableClientValidation(); %>
<% using (Html.BeginForm()) {%>
    <%: Html.ValidationSummary(true) %>

    <fieldset>
        <legend>Create New Request</legend>
        <%: Html.EditorFor(model => model.request,
               new {Softwares = Model.SoftwareName, Systems = Model.SystemIDNo}) %>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>

<% } %>

<div>
    <%: Html.ActionLink("Back to List", "Index") %>
</div>

the partial view its calling is workRequest.ascx

<p> 
    <%= Html.LabelFor(model => model.Medium)%> 
    <%= Html.TextBoxFor(model => model.Medium)%>
    <%= Html.ValidationMessageFor(model => model.Medium)%> 
</p> 
<p> 
    <%= Html.LabelFor(model => model.Summary)%> 
    <%= Html.TextBoxFor(model => model.Summary)%> 
    <%= Html.ValidationMessageFor(model => model.Summary)%> 
</p> 
<p> 
    <%= Html.LabelFor(model => model.Details)%> 
    <%= Html.TextAreaFor(model => model.Details)%> 
    <%= Html.ValidationMessageFor(model => model.Details)%> 
</p>
<p> 
    <%= Html.LabelFor(model => model.WorkHalted)%> 
    <%= Html.TextBoxFor(model => model.WorkHalted)%>  
    <%= Html.ValidationMessageFor(model => model.WorkHalted)%> 
</p>
<p> 
    <%= Html.LabelFor(model => model.Frequency)%> 
    <%= Html.TextBoxFor(model => model.Frequency)%>
    <%= Html.ValidationMessageFor(model => model.Frequency)%> 
</p>
<p> 
    <%= Html.LabelFor(model => model.StartDate)%> 
    <%= Html.TextBoxFor(model => model.StartDate, String.Format("{0:g}", Model.StartDate))%> 
    <%= Html.ValidationMessageFor(model => model.StartDate)%> 
</p>
<p>
    <%= Html.LabelFor(model => model.SoftwareID) %>
    <%= Html.DropDownList("SoftwareID", new SelectList(ViewData["Softwares"] as IEnumerable, Model.SoftwareID)) %>
</p>
<p>
    <%= Html.LabelFor(model => model.SystemID) %>
    <%= Html.DropDownList("SystemID", new SelectList(ViewData["Systems"] as IEnumerable, Model.SystemID)) %>
</p>

and the post create controller looks like

[HttpPost]
    public ActionResult Create(WorkRequest newRequest)
    {
        try
        {
            storeDB.AddToWorkRequests(newRequest);
            storeDB.SaveChanges();

            return RedirectToAction("Index");
        }
        catch
        {
            return View();
        }

    }

I put a break point in the try and checked the values coming into newRequest and everything in newRequest is null, like nothing is getting passed.

A similar situation occurs on the edit side of things as well, nothing is getting sent from the partial view to the controller at all.

Anyways I am sure its something fairly simple, I am new to MVC, ASP, C#, pretty much all of it. I dont normally ask other people for much, but I have been looking at this problem for quite some time and could use some fresh eyes on this one.

Thanks in advance!

  • 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-17T07:03:35+00:00Added an answer on May 17, 2026 at 7:03 am

    Try using the same view model type as parameter that you used to render the view and to which it is strongly typed:

    [HttpPost]
    public ActionResult Create(ViewModelUsedToStronglyTypeTheView model)
    {
        //model.request should be properly bound here
        try
        {
            storeDB.AddToWorkRequests(model.request);
            storeDB.SaveChanges();
            return RedirectToAction("Index");
        }
        catch
        {
            return View(model);
        }
    }
    

    Or using a prefix:

    [HttpPost]
    public ActionResult Create([Bind(Prefix = "request")] WorkRequest newRequest)
    {
        //model.request should be properly bound here
        try
        {
            storeDB.AddToWorkRequests(newRequest);
            storeDB.SaveChanges();
            return RedirectToAction("Index");
        }
        catch
        {
            return View();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey so I am attempting to write a BST but I am having a
Hey all, I'm writing a C program, and I want to have an array
Hey all. I think I have a logic error in my qry. The output
Hey all, I am writing a logviewer application. These logs are between 100-200 megs
Hey all, I am setting up a PHP web app that will make use
Hey all i am trying to find some code that would allow me to
hey all, i have a question about urlmapping in grails. I'm trying to make
Hey all, I'm having some trouble setting up my grails application. Running the app
hey all, is there any way to convert a given file (this could be
Hey all, I basically output content into a div like this using jquery: var

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.