MIS Professor Sandvig MIS 324 Professor Sandvig

Slides:



Advertisements
Similar presentations
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
Advertisements

Tutorial 6 Creating a Web Form
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
  Just another way to collect pieces together (like div, section)  Anything can be in there  Formatting just like all other elements.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
HTML Forms – Interactive HTML – Web 2.0. HTML – New types for input – Degrades gracefully for browsers that do not support the html 5 input types
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
JavaScript Form Validation
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
VB and C# Programming Basics. Overview Basic operations String processing Date processing Control structures Functions and subroutines.
  Just another way to collect pieces together (like div, section)  Anything can be in there  Formatting just like all other elements  Always name.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
1 Review of Form Elements. 2 The tag Used in between tags.  Form elements(text control, buttons, etc.. ) goes here. OR  Form elements(text control,
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
HTML FORMS The TEXT Object Presented By: Ankit Gupta.
Week 10: HTML Forms HNDIT11062 – Web Development.
Struts Tags Classification of Struts Tags are: Form tags. Control tags. Data tags. Ajax tags.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Tutorial 6 Creating a Web Form
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Creating and Processing Web Forms
Advanced HTML Tags:.
Jim Fawcett CSE686 – Internet Programming Spring 2014
Getting Started with CSS
Jim Fawcett CSE686 – Internet Programming Spring 2012
Social Media And Global Computing Introduction to The MVC Pattern
Objectives Design a form Create a form Create text fields
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CS3220 Web and Internet Programming HTML Tables and Forms
>> More on HTML Forms
ITE 115 Creating Web Page Forms
ASP.NET Razor Engine SoftUni Team ASP.NET MVC Introduction
HTML Forms CSC 102 Lecture.
JavaScript Forms Adding User Input.
Web Programming– UFCFB Lecture 17
Social Media And Global Computing Managing MVC with Model Validation
MIS Professor Sandvig MIS 324 Professor Sandvig
MIS Professor Sandvig MIS 324 Professor Sandvig
Introducing Forms.
HTML Forms and User Input
Web Systems Development (CSC-215)
Layout and Partial Views
Social Media And Global Computing Managing MVC with Model Validation
Forms, cont’d.
JavaScript Forms Adding User Input.
MIS Professor Sandvig MIS 324 Professor Sandvig
Customizing Views Views Customize කර ගැනීම
CNIT 131 HTML5 - Forms.
Creating and Configuring Models Models create කිරීම සහ config කර ගැනීම
CS3220 Web and Internet Programming HTML Tables and Forms
Web Development Using ASP .NET
05 | Customizing Views Jon Galloway | Development Platform Evangelist
Layout and Partial Views
Lesson 6: Web Forms.
HTML Forms
.NET Validation Controls
MIS Professor Sandvig MIS 324 Professor Sandvig
Presentation transcript:

MIS 324 -- Professor Sandvig MIS 324 Professor Sandvig 6/6/2018 MVC Views MIS 324 Professor Sandvig

MIS 324 -- Professor Sandvig 6/6/2018 Outline MVC Views Role HTML Helpers Razor

Role Views provide user interface Displays information Collect data Via Forms

Location Views folder Subfolder for each controller .cshtml file for each view

Location Default: Example: View name matches action method Controller name: dice Action method: index Calls: Views/dice/index.cshtml public ActionResult Index() { Return View(); }

Razor Syntax .NET MVC Views support Razor Syntax Razor: mixes html & C# Extension: .cshtml Razor prefixed with @ Example: <h2>@DateTime.Now.ToShortDateString()</h2>

Razor Syntax Multi-statement code block Use @{ …. } Example: @{ string date = DateTime.Now. ToLongDateString(); string greeting = "Hello!"; } <h3>@greeting! Today is @date </h3>

Razor Syntax Supports C# control structures If If else For loops Etc. Example: @for (int i = 0; i < 10; i++) { <h3>@i. Go Vikings!</h3> }

Razor Syntax Display model values:

HTML Helpers Generate HTML in view Textboxes Dropdown lists Validation messages Labels etc.

HTML Helpers Benefits: Two-directional: Validation Display data from controller Pass user inputs to controller Validation Strongly typed data to model

HTML Helpers HTML helper created by VS: HTML: @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } }) HTML: <input class="form-control text-box single-line" data-val="true" data-val-required="The Name field is required." id="Name" name="Name" type="text" value="Apollo" />

Validation Model Add DataAnnotations namespace “Decorate” properties with validation

Validation Attributes Default validation attributes Required StringLength Range RegularExpression CreditCard CustomValidation EmailAddress FileExtension MaxLength MinLength Phone

Validation Controller Form data is mapped to model Datatype & other attributes validated ModelState.IsValid

View VS examines model and generates view Contains form elements: Form tag Controls for user input Validation controls Labels Layout (using Bootstrap CSS framework)

HTML Helpers HTML Helper controls Use Razor syntax Write HTML Populate controls with model data Communicate with validation controls Examples: Html.TextBoxFor Html.TextAreaFor Html.CheckBoxFor Html.RadioButtonFor Html.DropDownListFor Html.EditorFor

HTML Helpers Example 1 - checkbox HTML helper: HTML Browser view @Html.EditorFor(model => model.IsSeaHawkFan) SeaHawks Fan? HTML <input checked="checked" class="check-box" data-val="true" data-val-required="The Seahawk Fan? field is required." id="IsSeaHawkFan" name="IsSeaHawkFan" type="checkbox" value="true" /> SeaHawks Fan? Browser view

HTML Helpers Example 2: textbox Html Helper HTML Browser @Html.TextBoxFor(model => model.FName, new { htmlAttributes = new { @class = "form-control" }, autofocus = "autofocus" }) HTML <input autofocus="autofocus" data-val="true" data-val-required="The First Name field is required." htmlAttributes="{ class = form-control }" id="FName" name="FName" type="text" value="" /> Browser

View Often need to edit default view Example: BigWebForm Add options for dropdown lists and radio buttons Modify formatting Relatively easy Example: BigWebForm

MIS 324 -- Professor Sandvig 6/6/2018 Web Form Summary