HTML Helpers Mait Poska & Andres Käver, IT Kolledž 2015 1.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
Advanced XSLT. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
CG0119 Web Database Systems Parsing XML: using SimpleXML & XSLT.
Sharpen Your MVC Views with Razor By Jon Marozick.
XML: Managing Data Exchange Stylesheets. Lesson Contents CSS The basic XSL file XSL transforms Templates Sort Numbering Parameters and Variables Datatypes.
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
Further exploring the View aspect of MVC Jim Warren, COMPSCI 280 S Enterprise Software Development.
Introduction to MVC Action Methods, Edit View, and a Search Feature NTPCUG Dr. Tom Perkins.
MVC 4 Spindustry Training.
Telerik School Academy ASP.NET MVC.
Learning WebMatrix Part 3 of 3 Akber Alwani
Processing XML Processing XML using XSLT Processing XML documents with Java (DOM) Next week -- Processing XML documents with Java (SAX)
Lecture 14. node-tests again: namespace-qualified node-tests I found a book. The fred:* node test admits only element in the fred namespace The match="book"
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
17 Apr 2002 XML Stylesheets Andy Clark. What Is It? Extensible Stylesheet Language (XSL) Language for document transformation – Transformation (XSLT)
Introduction to JavaScript for Python Programmers
MC 365 – Software Engineering Presented by: John Ristuccia Shawn Posts Ndi Sampson XSLT Introduction BCi.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
Beginner - WakeUpAndCode.com.
RightNow Tag Gallery URL: Staff profile must have WebDav option enabled.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
Introduction to ASP.NET MVC Information for this presentation was taken from Pluralsight Building Applications with ASP.NET MVC 4.
® IBM Software Group © 2007 IBM Corporation JSP Expression Language
By: Saurabh Dixit.  Groovy server pages  Taglibs  Validators in grails.
Jonathan Peterson Paladin Cloudware FILE -> NEW PROJECT E: G+: +JonathanPeterson42 GitHub &
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT part of XSL (Extensible Stylesheet Language) –includes also XPath and XSL Formatting Objects used to transform an XML document into: –another XML.
Freemarker ● Introduction ● Core features ● Java part example ● Template example ● Expressions ● Builtins ● Assigning value ● Conditions ● Loops ● Macros.
VB and C# Programming Basics. Overview Basic operations String processing Date processing Control structures Functions and subroutines.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
C# Programming Fundamentals Control Flow Jim Warren, COMPSCI 280 S Enterprise Software Development.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
Introduction to MVC Controllers NTPCUG Tom Perkins, Ph.D.
ASP.NET MVC Architecture Layouts, Filters, Sections, Helpers, Partial Views, Areas… SoftUni Team Technical Trainers Software University
More XML XPATH, XSLT CS 431 – February 23, 2005 Carl Lagoze – Cornell University.
Inside LINQ to Objects How LINQ to Objects work Inside LINQ1.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
Programming with Microsoft Visual Basic th Edition
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC -
ASP.NET MVC Advanced Topics
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class.
Review Expressions and operators Iteration – while-loop – for-loop.
Working with Data Model Binders, Display Templates, Editor Templates, Validation… SoftUni Team Technical Trainers Software University
XML Schema – XSLT Week 8 Web site:
INTRODUCTION TO MVC BY SUHA MNEIMNEH. WHAT’S THE AGENDA What is MVC? MVC components MVC vs web forms vs ASP.NET vocabulary When to create MVC application.
A first stab at a better templating system for Chisimba The Chisimba Canvas.
Kendo UI ASP.NET MVC Wrappers
Jim Fawcett CSE686 – Internet Programming Spring 2014
What’s the Problem Difficult to know what components are on a page
C++ Lesson 1.
Building Web Applications with Microsoft ASP
ASP.NET MVC Essentials ASP.NET MVC Telerik Software Academy
Test 2 Review Outline.
Jim Fawcett CSE686 – Internet Programming Spring 2012
Social Media And Global Computing Introduction to The MVC Pattern
ASP.NET Razor Engine SoftUni Team ASP.NET MVC Introduction
MIS Professor Sandvig MIS 324 Professor Sandvig
JavaScript.
ASP.NET Razor Engine SoftUni Team ASP.NET MVC Introduction
MVC Partial View.
Customizing Views Views Customize කර ගැනීම
STL - Algorithms.
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
05 | Customizing Views Jon Galloway | Development Platform Evangelist
MASTER PAGES.
Methods/Functions.
Web Programming and Design
Principles of Computer Programming (using Java) Chapter 5 Arrays
Presentation transcript:

HTML Helpers Mait Poska & Andres Käver, IT Kolledž

HTML Helpers  Output  Input  Form  Link 2

HTML Output helpers  DisplayFor  DisplayForModel  DisplayNameFor  DisplayNameForModel  DisplayTextFor  LabelFor  LabelForModel 3

HTML Input Helpers EditorFor TextAreaFor TextBoxFor DropDownFor EnumDropDownFor ListBoxFor RadioButtonFor HiddenFor CheckBoxFor PasswordFor 4

HTML Form helpers  BeginForm  BeginRouteForm  EndForm 5

HTML Link helpers  ActionLink  RouteLink 6

EditorFor  EditorFor(expression)  EditorFor(expression, additionalViewData)  EditorFor(expression, templateName)  EditorFor(expression, templateName, additionalViewData)  EditorFor(expression, templateName, htmlFieldName)  EditorFor(expression, templateName, htmlFieldName, additionalViewData) 7

Declaration - MSDN 8 public static MvcHtmlString EditorFor ( this HtmlHelper html, Expression > expression, string templateName, string htmlFieldName, Object additionalViewData )

templateName  If a template whose name matches the templateName parameter is found in the controller's Editor/Display Templates folder, that template is used to render the expression. If a template is not found in the controller's Editor/Display Templates folder, the Views\Shared\Editor/Display Templates folder is searched for a template that matches the name of the templateName parameter. If no template is found, the default template is used. 9

DisplayTemplates  Boolean.cshtml == true ? "very true" : "not so much")

Custom HTML helpers  (razor only)  Static method  Extension method 11

Custom Html helper  Inside the view LabelWithItalic(string content) } =>..…..)

Custom Html helper - static 13 namespace WebMVCDemoApp.Helpers { public class CustomHTMLHelpers { public static IHtmlString LabelWithItalic(string content) { string htmlString = String.Format( " {0} ", content); return new HtmlString(htmlString); }

Custom Html helper - static

Custom Html helper - extension 15 namespace WebMVCDemoApp.Helpers { public static class CustomExtensionMethods { public static IHtmlString LabelWithMark(this HtmlHelper helper, string content) { string htmlString = String.Format(" {0} ", content); return new HtmlString(htmlString); }

Custom Html helper - extension