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

The Archive Base Latest Questions

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

I want to be able to select a row in a table (which represents

  • 0

I want to be able to select a row in a table (which represents an invoice), choose a radio button which has an amount value and press ‘Confirm’. Once confirm is clicked, I want the status of the selected invoice to change to “Paid” or “Partly Paid” depending on the payment amount select. I also want a new payment entry to be added to the ClientPayments table that is related to the selected invoice, I want the PaymentAmount to be the radio button amount and the date to be the system date.

The code I have at the moment is producing an error, namely: The parameters dictionary contains a null entry for parameter ‘id’ of non-nullable type ‘System.Int32’.

Here is the code I have so far. In the View:

@using (Html.BeginForm("Confirm", "InvoiceController"))
{

foreach (var item in Model)
{
string selectedRow = "";
if (item.InvoiceNumberID == ViewBag.InvoiceNumberID)
{
    selectedRow = "selectedRow";
} 

<tr class="@selectedRow" valign="top">
            <td> 
           <a href='javascript:void(0)' class='select' data-id=@item.InvoiceNumberID     >Select</a>


        </td> 
     <td>
        @Html.DisplayFor(modelItem => item.InvoiceNumberID)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.InvoiceAmount)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.InvoiceMonth)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.InvoiceStatus)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.Client.FullName)
    </td>
    <td>
        @Html.ActionLink("Edit", "Edit", new { id = item.InvoiceNumberID }) |
        @Html.ActionLink("Details", "Details", new { id = item.InvoiceNumberID }) |
        @Html.ActionLink("Delete", "Delete", new { id = item.InvoiceNumberID })
    </td>
</tr>
}
<input type='hidden' id='id' name='id' value='0' />
}
</table>
<br />

<p><i>Select or type in a custom amount to confirm as paid:</i>
</p>
<table>
<tr><td><b>Monthly Amounts:</b></td><td><b>Weekly Amounts:</b></td></tr>
<tr><td>Private Lesson (1 Hour) @Html.RadioButton("InvoiceAmount", "640", true) R640.00<br  /></td><td>Private Lesson (1 Hour) @Html.RadioButton("InvoiceAmount", "160", true) R160.00<br /> </td></tr>
<tr><td>Private Lesson (1/2 Hour) @Html.RadioButton("InvoiceAmount", "350", true) R350.00<br  /></td><td>Private Lesson (1 Hour) @Html.RadioButton("InvoiceAmount", "87.50", true) R87.50<br  /></td></tr>
<tr><td>Group Lesson (1 Hour) @Html.RadioButton("InvoiceAmount", "460", true) R460.00</td>  <td>Private Lesson (1 Hour) @Html.RadioButton("InvoiceAmount", "115", true) R115.00<br /></td> </tr>
<tr><td>Custom Amount @Html.RadioButton("InvoiceAmount", "115", true)  @Html.TextBox("customAmount")<br /></td></tr>
</table>

<script type='text/javascript'>
    $('.select').click(function(){
            $('#id').val($(this).attr('data-id'));
                 alert($('#id').val());
             });
</script>

Confirm Payment

And the code in the controller is:

    public ActionResult Confirm(int id, long InvoiceAmount)
    {
        Invoices invoices = db.Invoice.Find(id);
        //now validate that if the logged in user is authorized to select and confirm this invoice or not.


        if (InvoiceAmount != invoices.InvoiceAmount)
        {
            invoices.InvoiceStatus = "Partly Paid";

        }
        else
        {
            invoices.InvoiceStatus = "Confirmed";
        }
        db.Entry(invoices).State = EntityState.Modified;
        db.SaveChanges();

        return View();
    }

The javascript alert shows the right ID that I select, but when I click Confirm, it doesn’t find the ID. Can anyone see where I’m going wrong?

Thanks,
Amy

  • 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-25T11:02:18+00:00Added an answer on May 25, 2026 at 11:02 am

    1) For the postback to work, you need to submit your form properly, for instance have a submit button inside your form;
    2) For adding a new entry to the ClientPayments table, you do something along the line of

    if (InvoiceAmount != invoices.InvoiceAmount)
    {
        invoices.InvoiceStatus = "Partly Paid";
    }
    else
    {
        invoices.InvoiceStatus = "Confirmed";
    }
    db.Entry(invoices).State = EntityState.Modified;
    
    var clientPayment = new ClientPayment();
    // Set clientPayment properties
    db.ClientPayments.Add(clientPayment);
    
    db.SaveChanges();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to select the columns that are displayed in my
I want to be able to select the div next in line (its not
I have a user that want to be able to select a textbox and
I have a multi-select list box. I want to be able to select a
I want to be able to make an HTTP call updating some select boxes
The following query returns a single row, as desired. The 'contracts' table has 6
I want to be able to get the next and previous row using SQLite.
In the table I want to be able to 'move' rows. I have a
I'm using LaTeX and BibTeX for an article, and I want to able to
Want to be able to provide a search interface for a collection of objects

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.