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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:47:38+00:00 2026-05-20T03:47:38+00:00

<%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<NerdDinner.Models.Dinner> %> <asp:Content ID=Content1 ContentPlaceHolderID=TitleContent runat=server> Details </asp:Content> <asp:Content

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

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        <%:Model.Title %></h2>
    <fieldset>
        <legend>
            <%: Model.HostedBy %></legend>
        <p>
            <strong>When: </strong>
            <%: Model.EventDate.ToShortDateString() %>
            <strong>at: </strong>
            <%: Model.EventDate.ToShortTimeString() %>
        </p>
        <p>
            <strong>Description: </strong>
            <%: Model.Description %>
        </p>
    </fieldset>
    <p>
        <%: Html.ActionLink("Edit Dinner", "Edit", new { dinner=Model }) %>
        |
        <%: Html.ActionLink("Delete Dinner", "Delete", new { id=Model.DinnerId }) %>
        |
        <%: Html.ActionLink("Back to Dinner list", "Index") %>
    </p>
</asp:Content>

public ActionResult Edit(Dinner dinner)
{
    //Dinner dinner = dinnerRepository.GetDinnerById(id);

    if (dinner == null)
        return View("NotFound");
    else
        return View(dinner);
}

[HttpPost]
public ActionResult Edit(Dinner dinner, object dummy)
{
    Dinner temp = dinnerRepository.GetDinnerById(dinner.DinnerId);

    if (TryUpdateModel(temp))
    {
        dinnerRepository.Save();

        return RedirectToAction("Details", new { id = dinner.DinnerId });
    }
    else
        return View(temp);
}
  • 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-20T03:47:39+00:00Added an answer on May 20, 2026 at 3:47 am

    Alternatively you can do as explained in Microsoft MSDN.

    public class PersonController : Controller
    {
        static List<Person> people = new List<Person>();
    
        //
        // GET: /Person/
        public ActionResult Index()
        {
            return View(people);
        }
    
        //
        // GET: /Person/Details/5
        public ActionResult Details(Person person)
        {
            return View(person);
        }
    
        //
        // GET: /Person/Create
        public ActionResult Create()
        {
            return View();
        } 
    
        //
        // POST: /Person/Create
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create(Person person)
        {
            if (!ModelState.IsValid)
            {
                return View("Create", person);
            }
    
            people.Add(person);
    
            return RedirectToAction("Index");
        }
    }
    

    Index.aspx

    <h2>Index</h2>
    
    <table>
        <tr>
            <th></th>
            <th>
                Id
            </th>
            <th>
                Name
            </th>
        </tr>
    
    <% foreach (var person in Model) { %>
    
        <tr>
            <td>
                <%= Html.ActionLink("Details", "Details", person )%>
            </td>
            <td>
                <%= Html.Encode(person.Id) %>
            </td>
            <td>
                <%= Html.Encode(person.Name) %>
            </td>
        </tr>
    
    <% } %>
    
    </table>
    
    <p>
        <%= Html.ActionLink("Create New", "Create") %>
    </p>
    

    Create.aspx

    <h2>Create</h2>
    
    <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
    
    <% using (Html.BeginForm()) {%>
    
        <fieldset>
            <legend>Fields</legend>
            <p>
                <label for="Id">Id:</label>
                <%= Html.TextBox("Id") %>
                <%= Html.ValidationMessage("Id", "*") %>
            </p>
            <p>
                <label for="Name">Name:</label>
                <%= Html.TextBox("Name") %>
                <%= Html.ValidationMessage("Name", "*") %>
            </p>
            <p>
                <label for="Age">Age:</label>
                <%= Html.TextBox("Age") %>
                <%= Html.ValidationMessage("Age", "*") %>
            </p>
            <p>
                <label for="Street">Street:</label>
                <%= Html.TextBox("Street") %>
                <%= Html.ValidationMessage("Street", "*") %>
            </p>
            <p>
                <label for="City">City:</label>
                <%= Html.TextBox("City") %>
                <%= Html.ValidationMessage("City", "*") %>
            </p>
            <p>
                <label for="State">State:</label>
                <%= Html.TextBox("State") %>
                <%= Html.ValidationMessage("State", "*") %>
            </p>
            <p>
                <label for="Zipcode">Zipcode:</label>
                <%= Html.TextBox("Zipcode") %>
                <%= Html.ValidationMessage("Zipcode", "*") %>
            </p>
            <p>
                <input type="submit" value="Create" />
            </p>
        </fieldset>
    
    <% } %>
    
    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>
    

    Details.aspx

    <h2>Details</h2>
    
    <fieldset>
        <legend>Fields</legend>
        <p>
            Id:
            <%= Html.Encode(Model.Id) %>
        </p>
        <p>
            Name:
            <%= Html.Encode(Model.Name) %>
        </p>
        <p>
            Age:
            <%= Html.Encode(Model.Age) %>
        </p>
        <p>
            Street:
            <%= Html.Encode(Model.Street) %>
        </p>
        <p>
            City:
            <%= Html.Encode(Model.City) %>
        </p>
        <p>
            State:
            <%= Html.Encode(Model.State) %>
        </p>
        <p>
            Zipcode:
            <%= Html.Encode(Model.Zipcode) %>
        </p>
    </fieldset>
    <p>
        <%=Html.ActionLink("Back to List", "Index") %>
    </p>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This markup: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<IEnumerable<FOO>> %> produces the error foreach statement
I have a simple view: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage %> <asp:Content ID=Content1
See below: Edit.aspx View: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<Test.Models.Friend> %> Edit <h2>Edit</h2> <%
I have a view that is strongly typed: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<MPKwithMVC.Models.SmartFormViewModel>
I have a main page which looks like: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage
I have my main view like this: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage %>
I'm trying to create a strongly typed partial view <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master
By default, when you print a web page, the page title and and URL
I created a new strong typed View ,something like this: <%@ Page Title= Language=C#
iam working on fileUpload in mvc. my code is as follows: Views/Client/AddClient.aspx <%@ Page

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.