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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:12:20+00:00 2026-05-16T06:12:20+00:00

I have the following asp.net mvc2 template: <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<ncontinuity2.core.dto.TrainingLookUpContainer> %> <%= Html.EditorFor(x

  • 0

I have the following asp.net mvc2 template:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ncontinuity2.core.dto.TrainingLookUpContainer>" %>
<%= Html.EditorFor(x => ViewData.Model.TrainingTree, "TrainingCategory")%>

You can see that I want to bind it to a model of type TrainingLookUpContainer.

The problem is, the following mark up is being generated:

<input id="ViewData_Model_TrainingTree_TrainingCourses_0__Uid" name="ViewData.Model.TrainingTree.TrainingCourses[0].Uid" type="hidden" value="cbd43b5a-2a6a-493f-98e4-9dc9010cbaaf" />

The bit I object to is the ViewData_Model_ prefix for the id of the element and the ViewData.Model. prefix for the name attribute.

I have no idea where this prefix is coming from and it of course means that the model never gets bound when it comes to posting the form.

Is there another way, I can control the mark up that is getting generated or is this a bug in the framework. I have used EditorFor in other parts and it works fine.

  • 1 1 Answer
  • 3 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-16T06:12:21+00:00Added an answer on May 16, 2026 at 6:12 am

    change

    <%= Html.EditorFor(x => ViewData.Model.TrainingTree, "TrainingCategory")%>
    

    to

    <%= Html.EditorFor(x => x.TrainingTree, "TrainingCategory")%>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If i have an ASP.NET MVC 2 Web Application with the following Views: Main.aspx
If I have the following in an ASP.NET Web Form: <asp:TextBox runat=server ID=tbxUser/> and
I'm using Fancybox 1.3.4 with ASP.NET MVC 3. I have following link : <a
In an ASP.NET MVC application where I have the following model.. public class EventViewModel
I have following markup which is generated dynamically using C# in my asp.net MVC2
I have created a new MVC2 project using the ASP.NET MVC2 Web Application, which
I have an IIS7.5 web-site, on Windows Server 2008, with an ASP.NET MVC2 web-site
I'm following an example out of my MVC2 book (ASP.NET MVC 2 Framework). My
i am using asp.net mvc 2 here i have a following class Applicant and
I have the following URLs for my ASP.Net MVC 2 site: http://localhost:1919/TimeEntry/SummaryForWeek/15/2011 http://localhost:1919/TimeEntry/SummaryForMonth/4/2011 Both

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.