Managing MVC Views with Controller Functions In VB.Net

Managing MVC Views with Controller Functions In VB.Net -...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Managing MVC Views with Controller Functions In VB.Net Application Development II IS 3920
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MVC View Data Passing data to a View through ViewData and Inline Code ViewData is a property of the ViewPage class It takes a field name and associates an object value to that name § ViewData("Message") = "Hello There!" Once set in a Controller function, it can be used in a View with Inline Code as follows: § <h2><%: ViewData("Message") %></h2>
Background image of page 2
MVC View Functions Can Pass Data to other View Functions View Functions can pass data to other Functions using Session Variables: Function Brochure() As ActionResult Session(“Name") = “John Smith" Session("Email") = "JohnSmith@gmail.com" Session("Phone") = "555-123-4567" Return View() End Function
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Formatting data in a View With the HTMLHelper Class There are many HTMLHelper functions from the HTML Helper class: http://msdn.microsoft.com/en-us/library/system.web.m The following formats an link with the text “Click here” and sends it to the “Brochure” view of the “Home” controller: § <%= Html.ActionLink("Click here","Brochure","Home") %>
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Managing MVC Views with Controller Functions In VB.Net -...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online