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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:19:21+00:00 2026-05-19T13:19:21+00:00

Goal: Display a website to fill out a form and also be enable to

  • 0

Goal:
Display a website to fill out a form and also be enable to make a validation before clicking on the send button.

problem:
The code [ScaffoldColumn(false)] doesn’t work when I use <%: Html.EditorForModel() %> in the view.

Questions:
What should I do?

// Fullmetalboy

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


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> 
    Address and Payment 
</asp:Content> 

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 

    <% using (Html.BeginForm()) {%> 

    <h2>Address and Payment</h2> 

    <fieldset> 
        <legend>Shipping Information</legend> 
        <%: Html.EditorForModel() %> 
    </fieldset> 


    <input type="submit" value="Submit Order" /> 
    <% } %>

</asp:Content>

private BokButikEntities _myBokButikEntities = new BokButikEntities();

//
// GET: /Checkout/

public ActionResult AddressAndPayment()
{
    return View();
}

// 
// POST: /Checkout/AddressAndPayment 

[HttpPost]
public ActionResult AddressAndPayment(FormCollection values)
{
    var order = new Order();
    TryUpdateModel(order);

    try
    {

        var cart = ShoppingCart.GetCart(this.HttpContext);

        order.Anvandarnamn = User.Identity.Name;
        order.OrderDatum = DateTime.Now;
        order.TotalKostnad = cart.KalkyleraTotalKostnad();

        //Save Order 
        _myBokButikEntities.AddToOrders(order);
        _myBokButikEntities.SaveChanges();

        //Process the order 
        cart.CreateOrder(order);

        return RedirectToAction("Complete", new { id = order.OrderID });

    }
    catch
    {
        //Invalid - redisplay with errors 
        return View(order);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc; 

namespace BokButik1.Models.Validation
{
    [MetadataType(typeof(OrderMetadata))] 
    public partial class Order
    {
        // Validerar data

        [Bind(Exclude = "OrderID")]
        public class OrderMetadata 
        {
            [Required(ErrorMessage = "Förnamn saknas")]
            [DisplayName("Förnamn")]
            [StringLength(50)]
            public object Fornamn { get; set; }

            [Required(ErrorMessage = "Efternamn saknas")]
            [DisplayName("Efternamn")]
            [StringLength(50)]
            public object Efternamn { get; set; }

            [Required(ErrorMessage = "Mobilnummer saknas")]
            [DisplayName("Mobilnummer")]
            public int Mobilnummer { get; set; }

            [Required(ErrorMessage = "Gatuadress saknas")]
            [DisplayName("Gatuadress")]
            [StringLength(50)]
            public object Gatuadress { get; set; }

            [Required(ErrorMessage = "Postnummer saknas")]
            [DisplayName("Postnummer")]
            public object Postnummer { get; set; }

            [Required(ErrorMessage = "Ort saknas")]
            [DisplayName("Ort")]
            [StringLength(50)]
            public object Ort { get; set; }

            [ScaffoldColumn(false)]
            public object OrderID { get; set; }

            [ScaffoldColumn(false)]
            public object OrderDatum { get; set; }

            [ScaffoldColumn(false)]
            public object TotalKostnad { get; set; }

            [ScaffoldColumn(false)]
            public object Anvandarnamn { get; set; }
        } 
    }
}
  • 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-19T13:19:21+00:00Added an answer on May 19, 2026 at 1:19 pm

    it doesn’t work because your view is not strongly typed to anything.

    it should be

    <%@ Page ... Inherits="System.Web.Mvc.ViewPage<Order>" %> 
    

    also if you would have an Order.ascx in your editor templates, the ScaffoldColumn would also don’t do anything

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

Sidebar

Related Questions

Goal: Display textbox and submit button on the same line in Jquery Mobile. Problem:
Goal: Display the value of the calculation in the html page. problem: After you
Goal: To display data with this list: Hour ----- 2 2,5 1 Problem: Is
Goal: Display different context menu if right clicking a row from the listview or
Goal: Display the created and customized control library component in the mainform screen Problem:
Goal: Display the result without using any line between column and row Problem: I
Goal: Display a custom location list on google maps based on the location of
My goal is to display two <div> s side-by-side with the content from both
On a Drupal app, my goal is to display a page with a couple
GOAL: I'm making a UDP socket to send and receive data. I am testing

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.