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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:49:50+00:00 2026-05-15T15:49:50+00:00

I have a really strange ‘bug’. I use this in my view: <% foreach

  • 0

I have a really strange ‘bug’. I use this in my view:

<% foreach (var QualitativeGlobalFeatureValue in Model.PossibleValues)
                            { %>
                                <% using (Html.BeginForm("DeleteQualitativeGlobalFeatureValue", "Features", FormMethod.Post, new { @class = "deleteForm" }))
                                   { %>
                                        <%= QualitativeGlobalFeatureValue.Value %>
                                        <%= Html.ActionLink("Edit", "QualitativeGlobalFeatureValueForm", new { FeatureId = Model.Id, Id = QualitativeGlobalFeatureValue.Id })%>
                                        <%= Html.Hidden("QualitativeGlobalFeatureValueId", QualitativeGlobalFeatureValue.Id)%>
                                        <%= QualitativeGlobalFeatureValue.Id %>
                                        <%= Html.Hidden("FeatureId", Model.Id)%>
                                        <input type="submit" value="Delete" class="link_button" /> 
                                <% } %>
                        <% } %>

This produces a bunch of forms which post to an action which then redirect to an action which in turn produces this view.

Here is some HTML:

<form action="/Features/DeleteQualitativeGlobalFeatureValue" class="deleteForm" method="post">b
                                        <a href="/Features/QualitativeGlobalFeatureValueForm?FeatureId=2103&amp;Id=3004">Edit</a>
                                        <input id="QualitativeGlobalFeatureValueId" name="QualitativeGlobalFeatureValueId" value="3004" type="hidden">
                                        3004
                                        <input id="FeatureId" name="FeatureId" value="2103" type="hidden">
                                        <input value="Delete" class="link_button" type="submit"> 
                                </form><form action="/Features/DeleteQualitativeGlobalFeatureValue" class="deleteForm" method="post">aa
                                        <a href="/Features/QualitativeGlobalFeatureValueForm?FeatureId=2103&amp;Id=9010">Edit</a>
                                        <input id="QualitativeGlobalFeatureValueId" name="QualitativeGlobalFeatureValueId" value="9010" type="hidden">
                                        9010
                                        <input id="FeatureId" name="FeatureId" value="2103" type="hidden">
                                        <input value="Delete" class="link_button" type="submit"> 
                                </form>

Now if I delete the value with the Id 9010 the resulting HTML is as follows:

<form action="/Features/DeleteQualitativeGlobalFeatureValue" class="deleteForm" method="post">b
                                        <a href="/Features/QualitativeGlobalFeatureValueForm?FeatureId=2103&amp;Id=3004">Edit</a>
                                        <input id="QualitativeGlobalFeatureValueId" name="QualitativeGlobalFeatureValueId" value="9010" type="hidden">
                                        3004
                                        <input id="FeatureId" name="FeatureId" value="2103" type="hidden">
                                        <input value="Delete" class="link_button" type="submit"> 
                                </form>

For some unexplainable reason it contains value=”9010″ rather than value=”3004″ although it uses the code QualitativeGlobalFeatureValue.Id

It just does not make sense. Is this some browser/caching issue? – I am using Firefox. Thanks!

Best wishes,

Christian

PS:

Actions:

[MembersOnlyAttribute]
        [AcceptVerbs(HttpVerbs.Get)]
        public ViewResult GlobalQualitativeFeature(string Id)
        {
            QualitativeGlobalFeature QualitativeGlobalFeature = null;

            if (TempData["ViewData"] != null)
            {
                ViewData = TempData["ViewData"] as ViewDataDictionary;
            }

            try
            {
                QualitativeGlobalFeature = FeatureService.GetQualitativeGlobalFeature(Id);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("Exception", e.Message);
            }

            return View("GlobalQualitativeFeature", QualitativeGlobalFeature);
        }


[MembersOnlyAttribute]
        [AcceptVerbs(HttpVerbs.Post)]
        public RedirectToRouteResult DeleteQualitativeGlobalFeatureValue(string QualitativeGlobalFeatureValueId, string FeatureId)
        {
            try
            {
                FeatureService.GetQualitativeGlobalFeatureValueRepository().DbContext.BeginTransaction();
                FeatureService.DeleteQualitativeGlobalFeatureValue(QualitativeGlobalFeatureValueId);
                FeatureService.GetQualitativeGlobalFeatureValueRepository().DbContext.CommitTransaction();
            }
            catch (Exception e)
            {
                ModelState.AddModelError("Exception", e.Message);
                FeatureService.GetQualitativeGlobalFeatureValueRepository().DbContext.RollbackTransaction();
            }

            TempData["ViewData"] = ViewData;

            return RedirectToAction("GlobalQualitativeFeature", new { Id = FeatureId });
        }
  • 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-15T15:49:50+00:00Added an answer on May 15, 2026 at 3:49 pm

    I suspect the following. You click on the delete button for the 9010. The form is posted and the POST request contains QualitativeGlobalFeatureValueId=9010. In the controller action the same view is rendered. Here’s the gotcha. When you write this:

    <%= Html.Hidden(
        "QualitativeGlobalFeatureValueId", 
        QualitativeGlobalFeatureValue.Id)
    %>
    

    The HTML helper (and not only this one) will first look if there’s a request parameter with the same name as the name of the field (QualitativeGlobalFeatureValueId) and will use this value instead of the one you specified as the second argument (that’s the way it is, don’t ask my why, it’s by design). So to fix this the only way is to manually render the hidden field:

    <input 
        id="QualitativeGlobalFeatureValueId" 
        name="QualitativeGlobalFeatureValueId" 
        value="<%= QualitativeGlobalFeatureValue.Id %>" 
        type="hidden" 
    />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a really strange enum bug in Java. for(Answer ans : assessmentResult.getAnswersAsList()) {
I'm experiencing something really strange! I have a div that I'm hiding with JS
What should i use to code Classic ASP under Linux. I have really tried
I have never really found the design view in Visual Studio useful when developing
Sorry about the strange title. I really have no idea how to express it
I've run into a really strange bug, that I'm hoping someone can explain. I
I have found this example on StackOverflow: var people = new List<Person> { new
We’ve found that the unit tests we’ve written for our C#/C++ code have really
I have some really complicated legacy code I've been working on that crashes when
I have a really big database (running on PostgreSQL) containing a lot of tables

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.