// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNet.Mvc
{
///
/// Indicates associated property or all properties of associated type should be edited using an <input>
/// element of type "hidden".
///
///
/// When overriding a inherited from a base class, should apply both
/// [HiddenInput(DisplayValue = true)] (if the inherited attribute had DisplayValue = false) and a
/// with some value other than "HiddenInput".
///
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class HiddenInputAttribute : Attribute
{
///
/// Instantiates a new instance of the class.
///
public HiddenInputAttribute()
{
DisplayValue = true;
}
///
/// Gets or sets a value indicating whether to display the value as well as provide a hidden <input>
/// element. The default value is true.
///
///
/// If false, also causes the default display and editor templates to return HTML
/// lacking the usual per-property <div> wrapper around the associated property and the default display
/// "HiddenInput" template to return string.Empty for the associated property. Thus the default
/// display template effectively skips the property and the default
/// editor template returns only the hidden <input> element for the property.
///
public bool DisplayValue { get; set; }
}
}