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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:57:43+00:00 2026-06-16T03:57:43+00:00

I cant successfully post the values from my partial view to my action –

  • 0

I cant successfully post the values from my partial view to my action – all the properties are null.

Partial View Model:

public class AddressViewModel
{
   public string ClientNumber { get; set; }
   public string Line1 { get; set; }
   public string Line2 { get; set; }
   public string Line3 { get; set; }
   public string Suburb { get; set; }
   public string PostalCode { get; set; }
}

Partial View:

@model Models.AddressViewModel
@{
    Layout = null;
}

@using (Html.BeginForm("UseAddress", "Home"))
    { 
<div>
    <table>
        <tr>
            <td>
                <div class="display-label">
                    @Html.DisplayNameFor(model => model.Line1)
                </div>
            </td>
            <td>
                <div class="display-field">
                    @Html.DisplayFor(model => model.Line1)
                </div>
            </td> 
........
        </tr>
    </table>

    <input type="submit" name="UseAddress" id="submitbutton" value="Use Address" />

</div>
}

Action:

[HttpPost]
[Authorize]
public ActionResult UseAddress(AddressViewModel model)
{
    return RedirectToAction("Index", "Home");
}

The partial view is rendered on the page by selecting a dropdown as follows:

<script type="text/javascript">
    $(function () {
        $('#AddressTypeDropdownList').change(function () {          
            var url = $(this).data('url');          
            $('#Address').load(url);
        });
    });
</script>

    @Html.DropDownListFor(
    x => x.SelectedAddressTypeId,
    new SelectList(Model.AddressTypes, "Value", "Text"),
    "-- Select Address Type --",
         new
         {
             id = "AddressTypeDropdownList",
             data_url = Url.Action("_Address", "Home")
         }
    )
    <div id="Address"></div>          


    public ActionResult _Address()
    {        
        AddressViewModel addressViewModel = new AddressViewModel {
            ClientNumber = "test"          
        };         

        return PartialView(addressViewModel);
    }

I would expect the UseAddress method to have the model.ClientNumber == "test" when I click the submit button but it is null…Is there anything obvious that I’m 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-16T03:57:44+00:00Added an answer on June 16, 2026 at 3:57 am

    DisplayFor doesn’t create input for the field so it won’t get posted. You’ll need to add

    @Html.HiddenFor(model => model.Line1)
    ....
    

    To post the values.

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

Sidebar

Related Questions

I can successfully receive values from my web service so in that repect the
I had successfully integrate twitter API and I am able to post text from
I cant find good solution to get information from other mysql tables when I
How can I post data using Jquery from selected data to the PHP? HTML
I'm having a simple action: [HttpPost] public virtual ActionResult New(Feedback feedback) { feedback.CreatedDate =
I can't build successfully project in VS2010 it shows me error: Error 579 Unable
Cant get this script to work with my menu really have tried everything any
Cant find the way to display friends, who achieve it, on achievement page. /USER_ID/achievements
Cant seem to get the following to find the 'skull' button when the 'heart'
I cant believe fastest solution for a multilined JLabel is the following one (text

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.