Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Part 40 Using displayname, displayformat, scaffoldcolumn attributes in asp net mvc application

  • kudvenkat
  • 2013-06-21
  • 125462
Part 40   Using displayname, displayformat, scaffoldcolumn attributes in asp net mvc application
displayattributesData Annotationsmvcmvc4asp.netmodelviewcontrollerDisplayAttributeDisplayFormatAttributeScaffoldColumnAttributemvc partial class metadatadate in mvc viewdatetime in mvc modeldate format in mvc razordate format in c# mvcformat date in mvc controllermvc hide field in viewmvc hide model property
  • ok logo

Скачать Part 40 Using displayname, displayformat, scaffoldcolumn attributes in asp net mvc application бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Part 40 Using displayname, displayformat, scaffoldcolumn attributes in asp net mvc application или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Part 40 Using displayname, displayformat, scaffoldcolumn attributes in asp net mvc application бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Part 40 Using displayname, displayformat, scaffoldcolumn attributes in asp net mvc application

In this video, we will discuss using the following attributes, with examples.
1. Display
2. DisplayName
3. DisplayFormat
4. ScaffoldColumn

Please refer to my blog using the link below, if you need the sql script for tblEmployee table.
http://csharp-video-tutorials.blogspo...

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

Generate ADO.NET entity data model for table tblEmployee. Change the entity name from tblEmployee to Employee. Save and build the project.

Right click on the "Controllers" folder and add "HomeController". Include the following "USING" statement.
using MVCDemo.Models;

Please Note: Replace LESSTHAN symbol with [ & GREATERTHAN symbol with ]

Copy and paste the following code.
public class HomeController : Controller
{
public ActionResult Details(int id)
{
SampleDBContext db = new SampleDBContext();
Employee employee = db.Employees.Single(x =] x.Id == id);
return View(employee);
}
}

Right click on the "Details" action method, and add "Details" view. Make sure you are creating a strongly typed view against "Employee" class. Select "Details" as the "Scaffold Template". Run the application and notice that, the output is not that pretty.

We can control the display of data in a view using display attributes that are found in System.ComponentModel.DataAnnotations namespace. It is not a good idea, to add display attributes to the properties of auto-generated "Employee" class, as our changes will be lost, if the class is auto-generated again.

So, let's create another partial "Employee" class, and decorate that class with the display attributes. Right click on the "Models" folder and add Employee.cs class file. Copy and paste the following code.
namespace MVCDemo.Models
{
[MetadataType(typeof(EmployeeMetaData))]
public partial class Employee
{
}

public class EmployeeMetaData
{
//If you want "FullName" to be displayed as "Full Name",
//use DisplayAttribute or DisplayName attribute.
//DisplayName attribute is in System.ComponentModel namespace.
//[DisplayAttribute(Name="Full Name")]
//[Display(Name = "Full Name")]
[DisplayName("Full Name")]
public string FullName { get; set; }

//To get only the date part in a datetime data type
//[DisplayFormat(DataFormatString = "{0:d}")]
//[DisplayFormatAttribute(DataFormatString="{0:d}")]

//To get time in 24 hour notation
//[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy HH:mm:ss}")]

//To get time in 12 hour notation with AM PM
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy hh:mm:ss tt}")]
public DateTime? HireDate { get; set; }

// If gender is NULL, "Gender not specified" text will be displayed.
[DisplayFormat(NullDisplayText = "Gender not specified")]
public string Gender { get; set; }

//If you don't want to display a column use ScaffoldColumn attribute.
//This only works when you use @Html.DisplayForModel() helper
[ScaffoldColumn(false)]
public int? Salary { get; set; }
}
}

Make sure to include the following using statements:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

We will discuss the following attributes in our next video session.
DataTypeAttribute,
DisplayColumnAttribute

Text version of the video
http://csharp-video-tutorials.blogspo...

Slides
http://csharp-video-tutorials.blogspo...

All ASP .NET MVC Text Articles
http://csharp-video-tutorials.blogspo...

All ASP .NET MVC Slides
http://csharp-video-tutorials.blogspo...

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...

All Dot Net and SQL Server Tutorials in Arabic
   / kudvenkatarabic  

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]