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

  • Home
  • SEARCH
  • 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 8963111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:17:15+00:00 2026-06-15T16:17:15+00:00

I have a complex type License as a view model. public class License {

  • 0

I have a complex type License as a view model.

public class License
{
    public string Name { get; set; }

    //  Other Properties

    public List<Function> Functions { get; set; }
}

public class Function
{
    public string Name { get; set; }

    //  Other Properties

    public List<Unit> Units { get; set; }
}

public class Unit
{
    public string Name { get; set; }

    //  Other Properties
}

Both the Function’s view template and Unit’s view template are dynamiclly rendered. So the html looks like this:

<!-- LicenseView -->
@model License

@Html.TextBoxFor(m => m.Name)  //  this is OK

@for(int i=0; i<Model.Functions.Count; i++)
{
    @Html.Partial(Model.Functions[i].Name, Model.Functions[i])
}

and the FunctionView may look like this

@model Function

@Html.TextBoxFor(m => m.Name)  //  the generated html element's name is just 'Name'

@for(int i=0; i < Model.Units.Count; i++)
{
    @Html.Partial(Model.Units[i].Name, Model.Units[i])
}

and this is UnitView

@model Unit

@Html.TextBoxFor(m => m.Name)  // the generated html element's name is just 'Name'

So my question is, what should I do the make the Name attribute correct?

Thanks a lot

  • 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-15T16:17:16+00:00Added an answer on June 15, 2026 at 4:17 pm

    As @Jack said… you can do this using Editors instead of PartialViews.

    BUT… if you really want to use PartialViews, you can do it, but the model to pass should be the top one (License). This way is similar of what David Jessee proposed, but splitting the one view in several.

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

Sidebar

Related Questions

I have a model with a complex type i.e. User/Addresses/List of Addresses public class
I have a complex type, with all string properties // Actual class is auto-generated
I have this complex type: <xsd:complexType name=Identifier> <xsd:sequence> <xsd:element name=Id type=xsd:string/> <xsd:element name=Version type=xsd:string/>
Assuming that I have a complex type, for example: interface IFoo { IBar {get;set;}
I have a complex type entity public class ComplexEntity : ComplexObject { private int
I have this schema: <xs:complexType name=foo> <xs:sequence> <xs:element name=oneBar type=xs:string minOccurs=0/> <xs:element name=twoBar type=xs:string
I have this in my xsd: <xs:element name=Parameter type=complex> and I want to define
I have a List of a complex type - an object with a few
I have a wsdl that contains the following complex type: <complexType name=OUTGROUP> <sequence> <element
I have the following complex type in my XML schema: <xs:complexType name=Widget mixed=true> <xs:sequence>

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.