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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:31:45+00:00 2026-05-12T12:31:45+00:00

Hi I have the following view that gets the values for the form fields

  • 0

Hi I have the following view that gets the values for the form fields from a viewdata that contains an instance of a class ApplicationSettingEntity. the ApplicationSettingEntity class contains an instance of a machineentity class as one of the attributes. The form is populated by values from
item.Id
item.Key
item.Machine.Name

When I edit the values the form returns the updated values for item.Id and item.Key but not item.Machine.Name

I inspected the value of item.Machine.Name as I am hydrating the form and It is setting the value of the text box correctly but data posted back for item.Machine is null when I hit the save button. What am I doing wrong?

        <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

        <%@ Import Namespace="AppSettings.Web.Models" %>
        <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
            Edit Application Setting
        </asp:Content>
        <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
            <strong style="color: Black;">
            <div>
                <%  if (ViewData["ApplicationSetting"] != null)
                    {
                        var item = (ApplicationSettingEntity)ViewData["ApplicationSetting"];
                %>
                        <%=Html.ActionLink("Back to List", "Index",
                                                       new
                                                           {
                                                               controller = "ApplicationSettings",
                                                               Applications = item.Id,
                                                               Machines = item.Machine.Id
                                                           })%>
                        </div>
                        <%=Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.")%>
                        <%
                            using (Html.BeginForm((bool)ViewData["IsAdd"] ? "SaveAdd" : "SaveEdit", "ApplicationSettings"))
                            {%>        
                                <fieldset>
                                    <legend><strong>Application Name:</strong>
                                    </legend>
                                    <p>
                                        <label for="Id" style="font-weight: bold;">
                                            Application Setting Id:</label>
                                        <%=Html.TextBox("Id", item.Id)%>
                                        <%=Html.ValidationMessage("Id", "*")%>
                                    </p>
                                    <p>
                                        <label for="Key" style="font-weight: bold;">
                                            Application Setting Key:</label>
                                        <%=Html.TextBox("Key", item.Key, new {style = "width:400px;"})%>
                                        <%=Html.ValidationMessage("Key", "*")%>
                                    </p>
                                    <p>
                                        <span style="font-weight: bold;">Machine Name: </span>            
                                        <%=Html.TextBox("MachineName", item.Machine.Name)%>

                                    </p>
                                    <p>
                                        <input type="submit" value="Save" />
                                    </p>
                                </fieldset>
                                <%
                            }%>
                        <div>
                            <%=Html.ActionLink("Back to List", "Index",
                                                           new
                                                               {
                                                                   controller = "ApplicationSettings",
                                                                   applicationId = item.Application.Id,
                                                                   machineId = item.Machine.Id
                                                               })%>
                        </div>
                        <%
                }%>
        </asp:Content>
  • 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-12T12:31:45+00:00Added an answer on May 12, 2026 at 12:31 pm

    You get the value of the post in the item MachineName of the form collection, because that is the first param of Html.TextBox

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

Sidebar

Ask A Question

Stats

  • Questions 240k
  • Answers 240k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer maybe you can try to hook the CreateProcess API in… May 13, 2026 at 7:16 am
  • Editorial Team
    Editorial Team added an answer Have a look at this DECLARE @Table TABLE( ID INT,… May 13, 2026 at 7:16 am
  • Editorial Team
    Editorial Team added an answer I had the same problem. I couldn't force my emulator… May 13, 2026 at 7:16 am

Related Questions

I have been attempting to have a object that I can use across multiple
Ok so I have a UIViewTable and a UISearchBar with two scope buttons. The
I'd like to have the browser act as if the user had pressed the
Hi i have a MasterPage (ASP.Net MVC) which contains a couple of loads for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.