HiddenInput Attribute - MVC

May 04, 2019 BY xtreme

Attribute that Indicate whether a property or field value should be rendered as a hidden input element.public class Product{ [HiddenInput(DisplayValue=false)] public string ISBN { get; set; }}Now this ISBN property will not render in browser, similar to input type hidden fieldnamespace: System.Web.M...

HandleError Attribute - MVC

May 04, 2019 BY xtreme

Provides built-in exception filters. It can be applied over the action method, on a Controller or at the global level. The HandleError attribute is the default implementation of IExceptionFilter. When we create a MVC application, the HandleError attribute is automatically included within the Global....

Remote Attribute - MVC

May 04, 2019 BY xtreme

A mechanism used to make remote server call to validate specific data without posting the entire form to the server. For example a registration form, having a username textbox and while entering username, we want to check whether that username already exists in database or not without posting the co...

Bind Attribute - MVC

May 04, 2019 BY xtreme

In MVC View that accepts user input and posts those inputs to a server we have the option to use the built-in Model-binding features to provide more control and security,    Exclude    Using Execlude Option, we can restrict the properties that are allowed to be bound au...

Attributes n Filters - MVC

May 03, 2019 BY xtreme

Attributes mark what the filter is applied to, on other way around, Filters are implemented as an attribute. The logic contained in a filter executes when the action method with which the filter is attached executes This is achieved by decorating the controllers or actions with ASP.NET MVC pre-defin...

Different Types Of Action Results In ASP.NET- MVC

Apr 23, 2019 BY xtreme

An ActionResult is a return type of a controller method in MVC. Types of ActionResult1, View, public ViewResult Index() { <!-- Normal Return --> ViewBag.ItemList = "Computer Shop Item List Page"; return View(); OR <!-- Return With Model --> @model School...

What are the different ways to pass/transfer content/data - MVC

Apr 23, 2019 BY xtreme

.A. From View To Controller 1. Transfer directly to the second View/Action <a href='@Url.Action("ActionTo", new ModelData { Name = "ItBlow" })'>click me</a> public ActionResult ActionTo(ModelData m){} 2. POST data to a [HttpPost] Index action @using (Html.BeginForm()) { ...