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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:57:15+00:00 2026-05-12T11:57:15+00:00

I have a get method passing in an object of type Store to the

  • 0

I have a get method passing in an object of type Store to the view, upon creating the view using the menu dialog (i.e. Create a strongly-typed view) it properly scaffolds out the form when I choose the view content to be Edit. Without changing anything on the view I add a post method that accepts a store object as the parameter. The properties on the object are never populated with the form data and I am unable to figure out why. A Request.Form.Count shows 14 items which is correct minus the Id which would make 15. If I type out each parameter separately they do get set. I can also use the FormCollection to get the values, but sure would be nice to pass the entire object back in and use that.

Is there a reason why this might be happening?

Store Definition:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DomainModel
{
    public class Store : GuidIdentityPersistenceBase
    {
        private string _address1;

        private string _address2;

        private string _city;

        private string _county;

        private int _oldStoreNumber;

        private string _faxNumber;

        private bool _hasHydraulicHose;

        private bool _hasInsCounter;

        private bool _hasPaintBooth;

        private bool _isHubStore;

        private bool _isOpenNightsWeekends;

        private int _newStoreNumber;

        private string _phoneNumber;

        private string _postalCode;

        private string _state;

        private IList _walls = new List();

        public virtual string Address1
        {
            get
            {
                return _address1;
            }
            set
            {
                _address1 = value;
            }
        }

        public virtual string Address2
        {
            get
            {
                return _address2;
            }
            set
            {
                _address2 = value;
            }
        }

        public virtual string City
        {
            get
            {
                return _city;
            }
            set
            {
                _city = value;
            }
        }

        public virtual string County
        {
            get
            {
                return _county;
            }
            set
            {
                _county = value;
            }
        }

        public virtual int OLDStoreNumber
        {
            get
            {
                return _oldStoreNumber;
            }
            set
            {
                _oldStoreNumber = value;
            }
        }

        public virtual string FaxNumber
        {
            get
            {
                return _faxNumber;
            }
            set
            {
                _faxNumber = value;
            }
        }

        public virtual bool HasHydraulicHose
        {
            get
            {
                return _hasHydraulicHose;
            }
            set
            {
                _hasHydraulicHose = value;
            }
        }

        public virtual bool HasInsCounter
        {
            get
            {
                return _hasInsCounter;
            }
            set
            {
                _hasInsCounter = value;
            }
        }

        public virtual bool HasPaintBooth
        {
            get
            {
                return _hasPaintBooth;
            }
            set
            {
                _hasPaintBooth = value;
            }
        }

        public virtual Guid Id
        {
            get
            {
                return _persistenceId;
            }
        }

        public virtual bool IsHubStore
        {
            get
            {
                return _isHubStore;
            }
            set
            {
                _isHubStore = value;
            }
        }

        public virtual bool IsOpenNightsWeekends
        {
            get
            {
                return _isOpenNightsWeekends;
            }
            set
            {
                _isOpenNightsWeekends = value;
            }
        }

        public virtual int NewStoreNumber
        {
            get
            {
                return _newStoreNumber;
            }
            set
            {
                _newStoreNumber = value;
            }
        }

        public virtual string PhoneNumber
        {
            get
            {
                return _phoneNumber;
            }
            set
            {
                _phoneNumber = value;
            }
        }
        public virtual string PostalCode
        {
            get
            {
                return _postalCode;
            }
            set
            {
                _postalCode = value;
            }
        }

        public virtual string State
        {
            get
            {
                return _state;
            }
            set
            {
                _state = value;
            }
        }

        public virtual IList Walls
        {
            get
            {
                return _walls.ToList().AsReadOnly();
            }
        }

        public virtual void AddWall(Wall wall)
        {
            wall.Store = this;
            _walls.Add(wall);
        }

    }
}

Get Action:

[AcceptVerbs(HttpVerbs.Get)]
        public ViewResult EditStore(Guid Id)
        {
            Store store;
            using (UnitOfWork.Start())
            {
                store = _storeRepository.GetStore(Id);
            }

            return View(store);
        }

Post Action (yes I realize there are no encoding checks etc, just rough here at first):

[AcceptVerbs(HttpVerbs.Post)]
           public ActionResult EditStore(Store store)
        {
            using (UnitOfWork.Start())
            {
                _storeRepository.Update(store);

                UnitOfWork.Current.Flush();
            }

            return RedirectToAction("EditStore", store.Id);
        }


<% using (Html.BeginForm()) {%>

    <fieldset>
        <legend>Fields</legend>
        <p>
            <label for="Address1">Address1:</label>
            <%= Html.TextBox("Address1", Model.Address1) %>
            <%= Html.ValidationMessage("Address1", "*") %>
        </p>
        <p>
            <label for="Address2">Address2:</label>
            <%= Html.TextBox("Address2", Model.Address2) %>
            <%= Html.ValidationMessage("Address2", "*") %>
        </p>
        <p>
            <label for="City">City:</label>
            <%= Html.TextBox("City", Model.City) %>
            <%= Html.ValidationMessage("City", "*") %>
        </p>
        <p>
            <label for="County">County:</label>
            <%= Html.TextBox("County", Model.County) %>
            <%= Html.ValidationMessage("County", "*") %>
        </p>
        <p>
            <label for="OLDStoreNumber">OLDStoreNumber:</label>
            <%= Html.TextBox("OLDStoreNumber", Model.OLDStoreNumber) %>
            <%= Html.ValidationMessage("OLDStoreNumber", "*") %>
        </p>
        <p>
            <label for="FaxNumber">FaxNumber:</label>
            <%= Html.TextBox("FaxNumber", Model.FaxNumber) %>
            <%= Html.ValidationMessage("FaxNumber", "*") %>
        </p>
        <p>
            <label for="HasHydraulicHose">HasHydraulicHose:</label>
            <%= Html.TextBox("HasHydraulicHose", Model.HasHydraulicHose) %>
            <%= Html.ValidationMessage("HasHydraulicHose", "*") %>
        </p>
        <p>
            <label for="HasInsCounter">HasInsCounter:</label>
            <%= Html.TextBox("HasInsCounter", Model.HasInsCounter) %>
            <%= Html.ValidationMessage("HasInsCounter", "*") %>
        </p>
        <p>
            <label for="HasPaintBooth">HasPaintBooth:</label>
            <%= Html.TextBox("HasPaintBooth", Model.HasPaintBooth) %>
            <%= Html.ValidationMessage("HasPaintBooth", "*") %>
        </p>
        <p>
            <label for="IsHubStore">IsHubStore:</label>
            <%= Html.TextBox("IsHubStore", Model.IsHubStore) %>
            <%= Html.ValidationMessage("IsHubStore", "*") %>
        </p>
        <p>
            <label for="IsOpenNightsWeekends">IsOpenNightsWeekends:</label>
            <%= Html.TextBox("IsOpenNightsWeekends", Model.IsOpenNightsWeekends) %>
            <%= Html.ValidationMessage("IsOpenNightsWeekends", "*") %>
        </p>
        <p>
            <label for="NewStoreNumber">NewStoreNumber:</label>
            <%= Html.TextBox("NewStoreNumber", Model.NewStoreNumber) %>
            <%= Html.ValidationMessage("NewStoreNumber", "*") %>
        </p>
        <p>
            <label for="PhoneNumber">PhoneNumber:</label>
            <%= Html.TextBox("PhoneNumber", Model.PhoneNumber) %>
            <%= Html.ValidationMessage("PhoneNumber", "*") %>
        </p>
        <p>
            <label for="PostalCode">PostalCode:</label>
            <%= Html.TextBox("PostalCode", Model.PostalCode) %>
            <%= Html.ValidationMessage("PostalCode", "*") %>
        </p>
        <p>
            <label for="State">State:</label>
            <%= Html.TextBox("State", Model.State) %>
            <%= Html.ValidationMessage("State", "*") %>
        </p>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>

<% } %>

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

Fiddler:

Address1=1234+Main+street&Address2=Suite+100&City=Anywhere&County=MyCounty&OLDStoreNumber=1&FaxNumber=18001112222&HasHydraulicHose=true&HasHydraulicHose=false&HasInsCounter=true&HasInsCounter=false&HasPaintBooth=false&IsHubStore=false&IsOpenNightsWeekends=false&NewStoreNumber=1&PhoneNumber=18001112222&PostalCode=11001&State=MyState
  • 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-12T11:57:15+00:00Added an answer on May 12, 2026 at 11:57 am

    The problem was with the IoC framework I was using. Well it wasn’t a problem with the framework itself, but rather my configuration of it. When using Castle Windsor for your IoC framework you must mark the containers being registered as having a lifestyle = Transient instead of the default Singleton. If you allow the default it will wreak havoc when using it as I am.

    Thank you all for your help.

    • 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.