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

The Archive Base Latest Questions

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

How to send id of a model property Name to Controller class in an

  • 0

How to send id of a model property Name to Controller class in an MVC4 application

  public class{
public Name{get;set;}
}

For Accesing name using id of that property
Update:
Here if change Name using jquery at runtime i want to send the changed name id to the controller class

UPDate:
This is my VIew

<script type="text/javascript">

$(function () {

    $('.editor input').blur(function () {
        $(this).hide();
        $(this).closest('p').find('label').html($(this).val()).show();

    });

    $('.editor label').click(function () {
        $(this).hide();
        $(this).closest('p').find('input').show();

    });

});

@using (Html.BeginForm("Homepage", "Home", FormMethod.Post))
{ 
     <div class="editor">

    <p>
        @Html.LabelFor(x => x.Name, Model.Name)
        @Html.EditorFor(x => x.Name)
       <input type="submit" value="OK"  />
       </p>

     <p>
        @Html.LabelFor(x => x.Company, Model.Company)
        @Html.EditorFor(x => x.Company)
      <input type="submit" value="OK" />
    </p>
     <p>
        @Html.LabelFor(x => x.City, Model.City)
        @Html.EditorFor(x => x.City)
         <input type="submit" value="OK" />
    </p>
</div> 
<input type="submit" value="OK"   />
}

This is my model

 public class Details
{

    public string Name
    { get; set; }


    public string Company
    { get; set; }


    public string City
    { get; set; }


}

This is my COntroller methods

 public ActionResult Homepage(Details d)
    {
        d.Name = "Rakesh";
        d.Company = "TCS";
        d.City = "DElhi";
        return View(d);
    }

    [HttpPost, ActionName("Homepage")]
    public ActionResult Indexof(Details d)
    {
      return View(d);
    }

Here i am editing and sending data to the controller but my problem is when i click on Rakesh for example and change the name then i need to click button twice then only the changed data is sent to the controller class

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

    Model:

    public class SomeModel {
        public string Name { get; set; }
    }
    

    Controller:

    [HttpPost]
    public ActionResult YourAction( SomeModel m )
    {
        if( ModelState.IsValid )
        {
            // use model
            var name = m.Name;
    
            return RedirectToAction( "Index", "Home" );
        }
        return View( m );
    }
    

    If this isn’t what you need, please clarify what’s this “id” you’re talking about.

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

Sidebar

Related Questions

I create view for register and send data to controller //app::import('Model','Myprofile'); Class MembersController extends
I have ajax request that do 3 missions: Save Model (DB) Send Email Give
Question: How do send data to a view model when using command binding? So
I'm trying to write a Ruby class that works similarly to Rails AactiveRecord model
I have View Model with inner ViewModel Address propery. public class CommonViewModel{ public AddressViewModel
I am trying to send a model to ASP.NET MVC controller action, but for
I got a view model like this: public class BaseViewModelTech : INotifyPropertyChanged { static
Here is the code in controller: [HttpPost, ValidateInput(true)] public ActionResult Contact(ContactForm model) { if
In my model class I have a boolean property DoNotEmail . In the UI
I send a model to a template. The model has a collection. In the

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.