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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:16:29+00:00 2026-05-16T10:16:29+00:00

Based on my co-worker’s code, he is passing HTML attributes into his form declaration

  • 0

Based on my co-worker’s code, he is passing HTML attributes into his form declaration in the view using BeginForm and the resulting HTML looks like:

<form action="/Reviewer/Complete" ipbID="16743" method="post">

How can I obtain the ipbID in my Controller code? I’ve trying

HttpContext.Request.QueryString["ipbID"]

… and …

Request.Form["ipbID"]

and I’ve even gone into debug and went through every part of Request.Form I could to see if the value was there somehow. Is it not a good practice to put values such as that in the form tag? Any and all help is appreciated. Thanks.

UPDATE:
I should inform you all that this form is being applied to a cell. The cells are in a dataTable. When I use it returns the first value that was hidden, but none of the subsequent ones.

UPDATE 2:
View

<% Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<PTA.Models.IPB>>" %>

<%@ Import Namespace="PTA.Helpers"%>

<b>Assigned IPBs</b>

<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    $('#sharedIPBGrid').dataTable();
  });
</script>

<%
if (Model != null && Model.Count() > 0)
{
%>
<table id="sharedIPBGrid" class="display">
  <thead>
    <tr>
      <th>
        <%=Html.LabelFor(m => m.FirstOrDefault().IPBName) %>
      </th>
      <th>
        <%=Html.LabelFor(m => m.FirstOrDefault().Status) %>
      </th>
      <th>
        <%=Html.LabelFor(m => m.FirstOrDefault().PubDate) %>
      </th>
      <th>
        <%=Html.LabelFor(m => m.FirstOrDefault().ChangeDate) %>
      </th>
      <th>
        <%=Html.LabelFor(m => m.FirstOrDefault().Priority) %>
      </th>
      <th>
        <%=Html.LabelFor(m => m.FirstOrDefault().Errors) %>
      </th>
      <th>
        Start
      </th>
      <th>
        Stop
      </th>
      <th>
        Complete
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
<%
  foreach(IPB ipb in Model)
  {
%>
      //Ignoring everything except for the Complete button as there's a lot of logic in there.
      <td>
<%
         if (ipb.StatusID == (int)PTA.Helpers.Constants.State.InWorkActive)
         {
           using (Html.BeginForm("Complete", "Reviewer", FormMethod.Post, new {ipbID = ipb.ID}))
           {
%>
             <%=Html.Hidden("ipbID", ipb.ID)%>
             <input type="submit" id="btnComplete" value="Complete" />
<%
           }
         }
%>
      </td>
<%
  }
%>
    </tr>
  </tbody>
</table>
<%
}
else
{
  Response.Write("No IPBs found!");
}
%>
  • 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-16T10:16:29+00:00Added an answer on May 16, 2026 at 10:16 am

    Don’t do as your coworker. It is wrong. There’s no ipbID attribute defined on the form tag meaning that you are producing invalid HTML. Also form attributes are never posted to the server so you cannot obtain them.

    I would recommend you using a hidden field which is far more natural. So instead of:

    <form action="/Reviewer/Complete" ipbID="16743" method="post">
    

    Try:

    <form action="/Reviewer/Complete" method="post">
        <input type="hidden" name="ipbID" value="16743" />
    

    And then Request["ipbID"] or a simple controller action parameter named ipbID will give you the required value.

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

Sidebar

Related Questions

I'm trying to make a Scala application server based on the classic worker pool
One of my applications is heavily using the worker crew model. Several threads are
I'm considering using Fat Entities from Lokad.Cloud in a new Azure based application. At
I have a Background worker that needs to be called multiple times based on
Based on my understanding: IIS invokes a single worker process for the whole asp.net
I am using background worker to do a long process on some files. I
Our Java application starts a worker thread (using Thread.start() ). Shortly thereafter it calls
Based on getting Query Execution Statistics using this extremely useful piece of SQL obtained
I have a MacBook Pro and an Intel based iMac... Heard a fellow co-worker
I have a vc++ 2005 dialog based application, where I use a worker thread

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.