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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:09:59+00:00 2026-05-19T09:09:59+00:00

I am learning, and managed to make a nice info display page, displaying lists

  • 0

I am learning, and managed to make a nice info display page, displaying lists of transactions. However, I have no added DropDown box, which has a list of Bank Accounts. It’s defaulted to All.

When the user selects an account, and presses the submit button, the page should then reloca with only transactions for that account.

I have created the drop down, and the form for it, like this:

    <form id="form1" runat="server">
<h2>
    Transactions:</h2>
<p>
    <%
        using (Html.BeginForm())
        {
    %>
    Bank Account:
    <% =Html.DropDownList("ddAccounts", Model.BankAccountItems)%> <input id="Submit1" type="submit" value="Select" />     
    <%
        }
    %>
</p>
</form>

My model contains this:

    public class AccountTransactionDisplay
{
    public AccountTransactionDisplay()
    {
        DisplayLines = new List<AccountTransactionDisplayLine>();
    }

    public SelectList BankAccountItems { get; set; }
    public List<AccountTransactionDisplayLine> DisplayLines {get; set; }
    public string ClosingBalance { get; set; }
}

public class BankAccountDropdownItem
{
    public string Text {get; set;}   
    public string Value {get; set;}
}

public class AccountTransactionDisplayLine
{
    public string RowColouring { get; set; }
    public string TransactionDate { get; set;}
    public string PayeeName { get; set; }
    public string Amount { get; set; }
    public bool AmountIsDebit { get; set; }
    public string CategoryName { get; set; }
    public string CostCenterName { get; set; }
    public string BudgetName { get; set; }
    public string RunningTotal { get; set; }
    public bool RunningTotalIsDebit { get; set; }
    public bool AlternateRowColour { get; set; }
    public bool HasSplitItems { get; set; }
}

So, AccountTransactionDisplay is the model I pass to the view. In that model, I have this:

 public SelectList BankAccountItems { get; set; }

That holds a list of items that are displayed in my Drop Down. That is being displayed correctly.

However, when the user clicks the submit button, I am unsure how to get the selected value back.

I thought that I would have a method in my controller that accepts the POST… So, I have added this:

        [HttpPost]
    public ActionResult Transactions(AccountTransactionDisplay model)
    {
        AccountTransactionDisplay trans = GetTransactions();
        return View(trans);
    }

And if I set a breakpoint, it is hitting this, but it seems model is empty. I need to add the id of the selected account ot the GetTransactions method, to do the filtering.

  • 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-19T09:10:00+00:00Added an answer on May 19, 2026 at 9:10 am

    When your page renders, view the source. Whatever the name attribute of the select element is, that is the name of a property you will need to add to your model, then the model binder will bind that value to your model. When a form is submitted, only name/value pair of the form fields are submitted (for the most part), so the select element’s name will be in the form data as well as its selected value, all of the options are not posted back, so MVC has no way of rebinding your SelectList property.

    HTH

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

Sidebar

Related Questions

No related questions found

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.