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

The Archive Base Latest Questions

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

I am having an issue getting data in my model on my MakePayment.cshmtl view.

  • 0

I am having an issue getting data in my model on my MakePayment.cshmtl view.

The AccountScreen.cshtml is calling the MakePayment.cshtml view:

@model SuburbanCustPortal.SuburbanService.CustomerData      

@{
    ViewBag.Title = "Account Screen";
 }

<h2>AccountScreen</h2>

<div class="leftdiv">
  <fieldset>
    <legend>customer info</legend>
    @Html.Partial("CustomerInfoPartialView", Model)
  </fieldset>

  <fieldset>
    <legend>delivery address</legend>
    @Html.Partial("DeliveryAddressPartialView", Model)
  </fieldset>

  <fieldset>
    <legend>delivery info</legend>
    @Html.Partial("DeliveryInfoPartialView", Model)
  </fieldset>
</div>

<div class="rightdiv">
  <fieldset> 
    <legend>balance</legend>
    <div>
      @Html.Partial("BalancePartialView", Model)
    </div>    
  </fieldset>

  <fieldset> 
    <legend>payment</legend>
    <div>
      @Html.Partial("MakePayment", Model)
    </div>    
  </fieldset>

  <fieldset> 
    <legend>billing info</legend>
    <div>
      @Html.Partial("BillingInfoPartialView", Model)
    </div>    
  </fieldset>
</div>

My MakePayment.cshtml view:

@model SuburbanCustPortal.SuburbanService.CustomerData

  @using (Html.BeginForm("MakePayment2", "Customer", FormMethod.Post))
  {
    <div style="text-align:center;">
      <input class="makePaymentInput" type="submit" value="Make a Payment" />
    </div>       
  }

My CustomerController:

public ActionResult AccountScreen(LogOnModel model)
{
  return ShowCustomer(model.AccountNumber);
}

public ActionResult MakePayment(CustomerData model)
{
  return View("MakePayment", model);
}

[HttpPost]
public ActionResult MakePayment2(CustomerData model)
{
  //CustomerData model = new CustomerData();
  var newmodel = new PaymentModel.SendToGateway();
  newmodel.AccountBalance = model.TotalBalance;
  newmodel.Amount = model.TotalBalance;

  return RedirectToAction("PrePayment", "Payment", newmodel);
}

The public ActionResult MakePayment(CustomerData model) is never being reached.

My problem: The [HttpPost] public ActionResult MakePayment2(CustomerData model) is being reached but the model has nulls in it.

I know the data initial model from the AccountScreen is being populated since the other views that are being rendered is showing data.

Anyone see what I am doing wrong?

  • 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-14T13:44:24+00:00Added an answer on June 14, 2026 at 1:44 pm

    The problem is there’s nothing inside your form except a submit button. You need to make sure input fields are there (either text boxes, select lists, or hidden fields), as those are what post data back to the controller.

    You could try using EditorForModel inside your partial view:

    @using (Html.BeginForm("MakePayment2", "Customer", FormMethod.Post))
    {
        @Html.EditorForModel()
        <div style="text-align:center;">
          <input class="makePaymentInput" type="submit" value="Make a Payment" />
        </div>       
    }
    

    Edit based on comments

    Razor doesn’t include an Html.HiddenForModel() method, for whatever reason. Possible workarounds:

    • List out each property of the model using Html.HiddenFor(model => model.Property)
    • Annotate the model properties with \[HiddenInput\]
    • Use EditorForModel() but wrap it in <div style="display: none;"></div> (NOTE that a malicious user can still modify the properties as if they were visible.)
    • Use only Html.HiddenFor(model => model.id) and fetch the model in the controller.
    • Use the serialization method in the MVC Futures assembly

    Related quesion here:

    • Is there some way to use @Html.HiddenFor for complete model?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having an issue with sockets where the data I'm sending is getting
I am having an issue getting my data to return. I have two times
I am having an issue getting observers to trigger when using seed data in
having an annoying issue with getting xml data from a url if i set
I'm having an issue getting a LINQ query to work. I have this XML:
I'm having an issue getting some code to work. Is there a way to
I'm having an issue getting files loaded into an app called GCS, by dragging
I'm having an issue getting this CSS for a sprite sheet to work on
I'm having an issue getting Appstats to work correctly. Using /appstats or /appstats/stats ends
I'm having an issue getting the correct value from my drop down box. Basically

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.