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

Related Questions

I have the following code that gets called after the view loads. It works
I have a large Ruby on Rails form that has the following partial view
I'm not sure what's wrong with the following setup. I have a View that
I have the following code that responds to a button click, changes the view
If i have a controller action Create that returns a view with the following
I have following view <asp:Content ID=Content2 ContentPlaceHolderID=MainContent runat=server> <h2>Tables <%=ViewData[RetriverName] %></h2> <%using (Html.BeginForm(ResfreshSelectedTables, Home))
I have the following form on an .NET MVC View: <form method=post enctype=multipart/form-data action=/Video/UploadDocument>
I have the following Helper that gets the FULL url of the current page
I have the following code that shows 5 posts each being the latest from
I have the following view controller in my UIPopover: @protocol StorePopoverDelegate - (void)storeSelected:(NSString *)store;

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.