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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:06:35+00:00 2026-06-14T21:06:35+00:00

I want to take some info from my model, edit one variable and pass

  • 0

I want to take some info from my model, edit one variable and pass it to post function. Here is my model:

public class TaskInputModel
{
    [Required]
    [Display(Name = "Input Value")]
    public decimal Value { get; set; }

    public long InputId { get; set; }

    public MetriceModelTaskShedule[] Tasks;
}

and this is my Index.cshtml:

@model MetriceWeb.Models.TaskInputModel

@foreach (var item in Model.Tasks)
    {

        using (Html.BeginForm())
        {
@Html.ValidationSummary(true)
<fieldset>
    <div class="editor-label">
        @Html.LabelFor(model => item.Task)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model =>  model.Value)
        @Html.ValidationMessageFor(model =>model.Value)
    </div>

    @Html.Hidden("Model.InputId", Model.InputId)

    <p>
        <input type="submit" value="Create" />
    </p>
</fieldset>
        }
}

I’m receiving this like that:

[HttpPost]
    public ActionResult Index(TaskInputModel model)
    {
        ...
    }

When I’m submitting only InputId has some value, Value is always 0. When i delete line: @Html.Hidden(“Model.InputId”, Model.InputId) Value is ok, but i don’t know how to receive InputId. Can you tell me how can I do this?

  • 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-14T21:06:37+00:00Added an answer on June 14, 2026 at 9:06 pm

    Problem solved. I just had to use @Html.Hidden(“InputId”, Model.InputId) instead of @Html.Hidden(“Model.InputId”, Model.InputId)

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

Sidebar

Related Questions

I want to find the centroid of each contour.for that i take some sample
i want to add some amounts which in my tuple. i want to take
I want to take the values if the variable I define are not equal
Here's what I want to achieve: I have a number of categories, each one
I want to write a Google Chrome Extension that can take information from a
I want to take a math expression that takes variables and print (assign to
I want to take backup or restore of my oracle database through .Net code.
I want to take advantage of DateTimePicker 's date validation, but the calendar seemed
I want to take an expression in tcl and convert its _ to <
I want to take HTML form data and handle the submited data(string for example)

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.