HTML and CSS Reference
In-Depth Information
To keep the things simple,
SaveCanvas()
doesn't perform any database operations, but you could add
them if you wish to persist the data in a database . The code stores the data in a session variable named
canvas_data
. A success message is returned to the caller by wrapping it in JSON format using the
Json()
method.
Adding a View
Next, right-click the
Index()
action method and select Add View from the shortcut menu. Add a new ASPX
view named Index (Figure 1-29).
Figure 1-29.
Adding an Index view
Add the markup shown in Listing 1-9 to the Index view located in the
Views/Home
folder.
Listing 1-9.
Markup for the Index View
<%@ Page Language=”C#” Inherits=”System.Web.Mvc.ViewPage<dynamic>” %>
<!DOCTYPE html>
<html>
<head runat=”server”>