ASP.NET Core Tag Helpers

Slides:



Advertisements
Similar presentations
Introduction to Web Design Lecture number:. Todays Aim: Introduction to Web-designing and how its done. Modelling websites in HTML.
Advertisements

HTML Basics Customizing your site using the basics of HTML.
A really fairly simple guide to: mobile browser-based application development (part 1) Chris Greenhalgh G54UBI / Chris Greenhalgh
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Sculpt Framework Mobile-First with Progressive Enhancement.
Chapter 4 Adding Images. Inserting and Aligning Images Using CSS When you choose graphics to add to a web page, it’s important to use graphic files in.
Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Responsive Web Design Design websites so that they can adapt to different devices seamlessly. Image by Muhammed RafizeldiMuhammed Rafizeldi.
Responsive Web Design, Discoverability, and Mobile Challenge
Performance, SEO, Accessibility Ivan Zhekov Telerik Corporation
WDV 331 Dreamweaver Applications Designing Websites for Mobile Devices Dreamweaver CS6 Chapter 11.
MVC New release IE8 Beta 1 Deep Zoom (sea dragon) Silver light 2.0 Beta 1 Expression Blend 2.5 Preview Instant Messaging API Enhancements to Virtual Earth.
Joel Bapaga on Web Design Strategies Technologies Commercial Value.
ASP.NET 5 Visual Studio 2015 Templates Bill Wolff Rob Keiser June 10, 2015.
Introduction to Silverlight. Slide 2 What is Silverlight? It’s part of a Microsoft Web platform called Rich Internet Applications (RIA) There is a service.
© Ms. Masihi.  The Dreamweaver Welcome Screen first opens when you start Dreamweaver.  This screen gives you quick access to previously opened files,
Advanced Level Course. Site Extras Site Extras consist of four categories: Stationeries Site Trash Designs Components.
How the Web Works Building a Website – Lesson 1. How People Access the Web Browsers People access websites using software called a web browser. To view.
PERFORMANCE ENHANCEMENT IN ASP.NET By Hassan Tariq Session #1.
Putting Performance Best Practices Together to Create the Perfect SPA Chris Love2Dev.com.
Project Two Adding Web Pages, Links, and Images Define and set a home page Add pages to a Web site Describe Dreamweaver's image accessibility features.
Contents : What is Silverlight? Silverlight Overview Silverlight Toolkit Overview Timeline & Packaging Silverlight V1.0 & V1.1 Properties of V1.0 Properties.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Dawn Pedersen. What is JavaScript? JavaScript is the basis for both jQuery and Spry applications JavaScript is referred to as a client-side scripting.
Website Design Best Practices. Topics  Navigation  Readability  Portability  Frameworks for Web Design  Model View Architecture MVC  SEO  Performance.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
MICROSOFT AJAX CDN (CONTENT DELIVERY NETWORK) Make Your ASP.NET site faster to retrieve.
//liveVirtualacademy2011/ What’s New for ASP.NET 4.5 and Web Development in Visual Studio 11 Developer Preview Γιώργος Καπνιάς MVP, MCT, MCDP, MCDBA, MCTS,
Fiddler and Your Website Robert Boedigheimer. About Me Web developer since 1995 Columnist for aspalliance.com Pluralsight Author 3 rd Degree Black Belt,
Build Cross-Platform Mobile Apps Using Visual Studio A Telerik webinar by Jeffrey T. Fritz March 27, 2014 AND.
Enhance Your Page Load Speed And Improve Traffic.
Chapter 2 Creating Website with Web Forms. Objectives Understand the different project types and templates when building ASP.NET web sites. The different.
C# Programming: From Problem Analysis to Program Design1 Visual Studio Configuration C# Programming: From Problem Analysis to Program Design 4th Edition.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 4.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
DHTML.
Exploring Computer Science - Lesson 3-4
Objective % Select and utilize tools to design and develop websites.
Exploring Computer Science - Lesson 3-4
CISC103 Web Development Basics: Web site:
ASP MVP Web applications and Razor
Inserting and Working with Images
Styling For Print From Screen to Paper
Responsive Images.
Creating Visual Effects and Animation
Debugging Your Website with Fiddler and Chrome Developer Tools
Haritha Dasari Josue Balandrano Coronel -
Exploring Computer Science - Lesson 3-4
Objective % Select and utilize tools to design and develop websites.
Introduction to Silverlight
Prepared for Md. Zakir Hossain Lecturer, CSE, DUET Prepared by Miton Chandra Datta
5 Optimization Techniques for WordPress Websites.
Images and Backgrounds
CISC103 Web Development Basics: Web site:
Web Development in Microsoft Visual Studio 2013
Playing Audio (Part 1).
.NET and .NET Core 7. XAML Pan Wuming 2017.
Graphics (Characteristics 1)
Web Design Designing for the Unknown.
Objective Understand web-based digital media production methods, software, and hardware. Course Weight : 10%
Why use Web Standards?.
Building ASP.NET Applications 2
Web Client Side Technologies Raneem Qaddoura
Web Client Side Technologies Raneem Qaddoura
And Mobile Web Browsers
4.00 Apply procedures to add content by using Dreamweaver. (22%)
#01# ASP.NET Core Overview Design by: TEDU Trainer: Bach Ngoc Toan
Running C# in the browser
Yale Digital Conference 2019
Christopher Harrison Jeremy Foster
Presentation transcript:

ASP.NET Core Tag Helpers

About Me Web developer since 1995 Pluralsight Author 3rd Degree Black Belt, Tae Kwon Do ASP.NET MVP boedie@outlook.com @boedie weblogs.asp.net/boedie

ASP.NET Core Open source and cross platform No more System.Web.dll! Full .NET Framework, .NET Core (Windows, Mac, Linux) No more System.Web.dll! MVC/Web API unified (no Web Forms) Modular wwwroot folder Tag Helpers Cross platform Windows Mac Linux Web Forms is NOT in .NET Core (use Full .NET Framework) wwwroot – only files from this folder will be served

Razor View engine for ASP.NET MVC HTML with server side code fragments @ prefix for code blocks Visual Studio IntelliSense .cshtml (C#), .vbhtml (VB)

Tag Helpers “Enable server-side code to participate in creating and rendering HTML elements in Razor files” Goal is to look much more like HTML Pascal-cased class and property names for tag helpers are translated into their “lower kebab” case Look like HTML – really helps designers Microsoft.AspNetCore.Razor.Tools Purple font on elements and attributes impacted by tag helper (needed to install “Razor Language Services”) Compared to web server controls “Don’t own the element they’re associated with; they simply participate in the rendering of the element and content” “Tag Helpers can modify the tag and content of HTML elements that they’re scoped to, but don’t directly modify anything else on a page” No DOM

Built In Tag Helpers <environment> <cache> <distributed-cache> Attributes Form Link and script Image Anchor <distributed-cache> supports SQL Server or Redis

Custom Tag Helpers Derive from TagHelper Implement ITagHelper, Target elements based on element name or attributes Visual Studio “Razor Tag Helper” template Target elements using [HtmlTargetElement] or match based on class name (up to TagHelper) Add to _ViewImports.cshtml or individual view files

Images http://httparchive.org/interesting.php#bytesperpage 63% of average page weight is images (3/1/2016), 59% in Nov 2010 Average web page has 100 requests, 54 of which are images (http://httparchive.org/trends.php) Alexa Top 1,000,000 Sites (http://www.alexa.com/topsites) JPG (46%), PNG (29%), GIF (23%), SVG (1%), WebP (0%) http://httparchive.org/interesting.php#bytesperpage

Lazy Load Images jQuery plugin and modified HTML to request images as scroll down data-original – set to image URL src – set to 1x1 clear pixel image Pages with lots of images only load those “above the fold” http://www.appelsiini.net/projects/lazyload

Responsive Image Goals Avoid images if possible CSS 3 (gradients, rounded corners, etc.) Web Fonts Icon Fonts Vector images if possible (SVG) Want to efficiently provide the most appropriate image for the design and device Web fonts – often used images in the past to get specific fonts

Responsive Image Techniques CSS 3 Media Queries JavaScript Server Image Adaptation New Image Format? … <picture> <img srcset… Client Hints CSS 3 Media Queries Background images Image-set( ) – not well implemented yet (be like using “srcset” for bg images) http://caniuse.com/#search=image-set JavaScript approaches had various choices for “src” (mobile version, 1x1 pixel, desktop, etc.) that cause some level of double download (and rely on JavaScript support) “Lookahead pre-parser” starts to request images before CSS and JavaScript downloads are completed… Steve Souders - “preloading is the single biggest performance improvement browsers have ever made.” Client Hints - http://caniuse.com/#search=client%20hints

<picture> http://tinyurl.com/j5zsmf2 Use Cases (http://usecases.responsiveimages.org) “Art Direction” Image Formats Want specific control over what is loaded… https://html.spec.whatwg.org/multipage/embedded-content.html#the-picture-element Art Direction – “change an image so it can be targeted towards the features of a particular display” (often cropping) Order of sources matter “We’re progressively enhancing the img by wrapping it in a picture.” (so styles and such go against img)

<img srcset… http://tinyurl.com/m894jsw Use Cases (http://usecases.responsiveimages.org) Resolution/Viewport Device-pixel-ratio Rest Inform browser about image widths and let it do what is “best”… https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-srcset Resolution/Viewport – most common case to show same image at various sizes Device-pixel-ratio – 1, 1.5, 2, 3 Sizes – tells the browser roughly how big the image will be (since don’t know rendered size yet), unfortunate need that in markup… “unless the image source matches exactly the size that the image is being displayed in the page, it is always going to be too big. There is always going to be an opportunity to optimize it further by providing a smaller image” (Jason Grigsby) Eventually do network connection speed detection or user preferences??

Picturefill http://scottjehl.github.io/picturefill/ Polyfill for srcset and <picture> http://caniuse.com/#search=srcset

Multiple Tag Helpers Multiple tag helpers can apply to the same element Order – runs applicable tag helpers lowest to highest value Code as if previous tag helper may have already modified…

Miscellaneous @tagHelperPrefix Opt out using “!” Can change how they look (Tools > Options > Environment > Fonts and Colors) 3rd party tag helpers (Telerik, DevExpress, Component One, …) Opt out using ! <!div></!div>

ASP.NET Core 2.0 TagHelperComponent <environment> - include/exclude

Resources github.com/aspnet www.asp.net/core https://docs.asp.net/en/latest/mvc/views/tag-helpers/index.html https://www.pluralsight.com/courses/responsive-web-images

Questions boedie@outlook.com @boedie weblogs.asp.net/boedie