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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:55:12+00:00 2026-05-19T11:55:12+00:00

What I am doing is this. I have a basic table with a button

  • 0

What I am doing is this. I have a basic table with a button at the end of each row for “selection” of that row for further actions. My action method has two simple parameters I’ll call them id1 and id2 so:

public ActionResult DoSomething(int id1, int id2)

id1 will be bound from a hidden form field outside the scope of the table, this works fine.

id2 needs to come from a hidden column from an individual row in the table depending on the button clicked representing the row that requires further processing. Make sense?

When the form posts back to the action method, id1 is set perfectly, no problem, but id2 is always the value of the hidden column from row 1. How do I detect/make DefaultModelBinder pull the hidden column value from the row from which the button is being clicked?

Thanks for the assist as I am actively trying to figure this out.


Here is the hidden table column that is rendered per row that I want to capture it’s value on the post from the row from which the button was clicked:

<td style="display:none;">@Html.Hidden("id2", viewModel.id2)</td>
  • 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-19T11:55:13+00:00Added an answer on May 19, 2026 at 11:55 am

    You could use simple hyper links instead of forms on each row. Like this:

    @Html.ActionLink("link text", "DoSomething", "SomeController", new {
        id1 = viewModel.id1, id2 = viewModel.id2
    }, null)
    

    which assuming default routes should generate the following link:

    /somecontroller/DoSomething?id1=123&id2=456
    

    and when you click on it the DoSomething action will be invoked with correct parameters.


    If you want to do this with POST you will need multiple forms, one for each row:

    @using (Html.BeginForm("DoSomething", "somecontroller"))
    {
        @Html.Hidden("id1", viewModel.id1)
        @Html.Hidden("id2", viewModel.id2)
        <input type="submit" value="OK" />
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic property bag table that stores attributes about my primary table
So i have this very basic ipad view controller and i was doing some
I have some code doing this : var changes = document.getElementsByName(from); for (var c=0;
Does anyone have any experience with doing this? I'm working on a Java decompiler
Basically you have two ways for doing this: for (int x = 0; x
I'm probably doing this all wrong. I have a text file full of data
I would like to have a nice template for doing this in development. How
I have a basic MySQL table, terms , comprised of an id and term
I have a table called PX_Child that has a foreign key on PX_Parent. I'd
I'm doing this system Stacked and I am creating the search function. And in

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.