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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:30:17+00:00 2026-06-03T12:30:17+00:00

I have a situation in an MVC3 app where I would like to be

  • 0

I have a situation in an MVC3 app where I would like to be able to set the name attribute on some html being generated by a helper (DropDownList).

It appears this is not possible. Apparently the helpers silently override whatever value you may specify for the name attribute in the html attribute object that you pass to the helper.

I’d like to confirm that before I waste too much more time on trying to work with the existing helpers.

And, as an aside, if it is not possible by design…I think that’s a foolish limitation in the MVC framework. Yes, I know that assigning the wrong name attribute can break the automatic model binding. But I should be able to do that when I need to. After all, I can always write the raw html using whatever name attribute I chose. The helpers should help, not be a straitjacket.

Edit to discuss whether editor templates maintain navigational context

Darin, I am using editor templates (I was using the term “partial” generically, since editor templates are a special kind of partial view).

Editor templates do modify the HtmlFieldPrefix — that’s how I noticed I had a problem :). I was using a call like this:

// call in higher level partial - context is 'eae'
@Html.EditorFor(m => m.Value)
...
// inside editor template for typeof(Value) context is 'eae:Value'

That context shift is needed to keep the default binding mechanism working properly. I’m using a different approach, where I want the context to stay fixed throughout a call chain of partials (i.e., as execution burrows down into deeper partials I want the context to stay the same).

  • 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-03T12:30:20+00:00Added an answer on June 3, 2026 at 12:30 pm

    This is by design. The HTML helpers do not allow you to override the name attribute. They generate the name based on your view model so that the default model binder is able to properly bind the values according to the well established conventions when the form is submitted.

    And, as an aside, if it is not possible by design…I think that’s a
    foolish limitation in the MVC framework.

    You could open a ticket on MS Connect and hope this could change in a future version of the framework. Until then you could also write your own custom helpers that will allow you to override the name attribute for the cases when you need such functionality. Personally I’ve never needed it so far but I am sure you have valid reasons. Another possibility is to write a custom model binder on the server.

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

Sidebar

Related Questions

I have a situation where I would like to present a list of the
I have a situation where I would like to do something simular to what
i have situation like this: class IData { virtual void get() = 0; virtual
I have situation where a user can manipulate a large set of data (presented
I have situation like this: user submits form with action='/pay' in '/pay' I have
I have situation, when user prepare some data in ASP.NET application, it save them
I have situation when the current directory becomes invalid (ie, when some program deletes
I have situation where I have to call method of interface using reflection, like
Im creating a custom field in MVC3 (C#) that I would like to access
Possible Duplicate: What is my script src URL? I have situation: <script type=text/javascript src=http://server/some.js>

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.