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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:38:48+00:00 2026-05-31T12:38:48+00:00

I’m using this tutorial at the moment. (I believe my issue is related to

  • 0

I’m using this tutorial at the moment.

(I believe my issue is related to strongly typed collections… by what I’ve been seeing on the internet, but I could be wrong)

Please bear with me. 🙂

I’ve been having this issue which I asked in another question, the answer seemed fine, but after tinkering with the code a bit more I realized that the issue is that the fields that make use of my custom partial view, don’t get a prefix added to them like the fields that use a TextBoxFor html helper, for example. EG. When I click on add a new item, it adds it, but with the same ID as an item that’s been added before, then my Javascript fails because there’s two items with the same id.

Some code to try and clarify the issue

Partial View

@model Portal.ViewModels.Micros
@using Portal.Helpers
<div class="editorRow" style="padding-left:5px">
    @using (Html.BeginCollectionItem("micros"))
    {  
        @Html.EditorFor(model => model.Lab_T_ID)
        @Html.EditorFor(model => model.Lab_SD_ID)         
        @Html.TextBoxFor(model => model.Result)
        <input type="button" class="deleteRow" title="Delete" value="Delete" />
    }
</div>

The TextBoxFor (Result) gets rendered as

<input id="micros_5e14bae5-df1b-4c42-9e96-573a8e52f8b2__Result" name="micros[5e14bae5-df1b-4c42-9e96-573a8e52f8b2].Result" type="text" value="">

Editor For get rendered as

<select id="Lab_SD_ID" multiple="multiple" style="width: 300px; display: none; " >
      <option value="5" selected="selected">Taken at Packing 1</option>
      <option value="6">Taken at Packing 2</option>
      <option value="7">Taken at Packing 3</option>
</select>

 <button type="button" class="ui-multiselect ui-widget ui-state-default ui-corner-all" aria-haspopup="true" tabindex="0" style="width: 300px; ">
<span class="ui-icon ui-icon-triangle-2-n-s"></span><span>Taken at Packing (Winc 4/5-25d)</span></button>

I can include more code if its needed, there is a helper class as well (BeginCollectionItem), that I used which is located in the demo project in the tutorial as well.

I basically need to find out how “micros[5e14bae5-df1b-4c42-9e96-573a8e52f8b2].” gets appended to the input boxes as far as I can see, but have been stumped by it so far :/

  • 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-31T12:38:50+00:00Added an answer on May 31, 2026 at 12:38 pm

    The reason this works with TextBoxFor and not your custom EditorFor is because the TextBoxFor helper respects the template navigational context whereas in your editor template you have simply hardcoded a <select> element that doesn’t even have a name. I would recommend you to use HTML helpers when generating input fields:

    So replace your hardcoded select in the custom template with:

    @model int?
    @{
        var values = ViewData.ModelMetadata.AdditionalValues;
    }
    
    <span>    
        @Html.DropDownList(
            "", 
            Enumerable.Empty<SelectListItem>(), 
            new { 
                multiple = "multiple",
                style = "width:" + values["comboboxWidth"] + "px",
                data_url = Url.Action((string)values["action"], (string)values["controller"]),
                data_noneselectedtext = values["noneSelectedText"],
                data_value = values["id"],
                data_text = values["description"]
            }
        )
    </span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,

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.