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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:04:23+00:00 2026-06-10T21:04:23+00:00

Consider I have the following classes as ViewModels public class Address { public String

  • 0

Consider I have the following classes as ViewModels

public class Address
{
    public String Street { get; set; }
}

public class Person()
{
    public Address Address { get; set; }
}

If I have a View which Model is Person, I can do this:

@Html.EditorFor(model => model.Address.Street)

The resulting input name will be Address.Street and, when I post it to an Action, the default model binder is able to realize that the input which name is Address.Street actually refers to the property Street inside the property Address.

That works fine.

However, I have a problem when I try to use this:

this.Url.Action("MyAction", myPerson)

I expect the Url serializer to build a queryString like this: /person/edit?Address.Street=X but it actually does’t serialize the Address property.

Is there something I can do to make the Url serializer to work in this scenario?

  • 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-10T21:04:24+00:00Added an answer on June 10, 2026 at 9:04 pm

    I think there is no default solution for it because Url.Actoin internally create RouteValueDictionary from object that you specify (in your case it myPerson). And RouteValueDictionary fill key/value pairs using following method :

      private void AddValues(object values) { 
            if (values != null) { 
                PropertyDescriptorCollection props = TypeDescriptor.GetProperties(values);
                foreach (PropertyDescriptor prop in props) { 
                    object val = prop.GetValue(values);
                    Add(prop.Name, val);
                }
            } 
        }
    

    And as result for address you get following pair { “Address”, person.Address }
    And finally route just convert value to string and add it to query string and as result in query string you get ?Adress=[person.Address.ToString()])

    I think the simplest way to do it is write a helper which will build RouteValueDictionary from object in way that you need.

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

Sidebar

Related Questions

Consider I have the following classes: class User { [Key] public Guid Id {get;
Consider that I have the two following nested classes: public class Foo { public
Consider I have the following classes: /// File classes.d class C { string type()
Consider, I have the following 3 classes / interfaces: class MyClass<T> { } interface
Consider you have the following class public class OuterClass { ... private static class
Today, I've stumbled over the following: Consider two classes NewClass and NewClass1, which have
Okay, consider the following classes: class Object { public: // Constructor Object() : [Initialization
I have the following problem. Consider the classes class face { virtual std::vector<ptr>& get_vertices(void)
Consider the following existing classes which uses MEF to compose Consumer . public interface
Consider the following example. I have an interface MyInterface, and then two abstract classes

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.