I have this regular code in a cshtml page that call the following controller.
@using (Html.BeginForm("Index", "Employees", FormMethod.Post))
{
<!-- Example of a Checked Checkbox -->
@Html.CheckBox("Example")
<input type="submit" value="Submit your Form" />
}
[HttpPost]
public ActionResult Index(bool Example)
{
if (Example)
{
HttpCookie cookie = new HttpCookie("Cookie");
cookie.Value = "Hello Cookie! CreatedOn: " + DateTime.Now.ToShortTimeString();
cookie.Expires = DateTime.Now.AddMinutes(5);
this.ControllerContext.HttpContext.Response.Cookies.Add(cookie);
}
return RedirectToAction("Index");
}
I would like to add the following code above it in a regular aspx page that is running MVC in the background. Please help .....Nor sure what is the syntax of the check box...
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Website.Models.IndexViewModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Yummy. Test</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<% Html.RenderPartial("SubNavMenu",this.Model.snmvm, new ViewDataDictionary()); %>
<div class= "divSectionCopy">
<div id="Disclaimer" style="padding-removed10px;">
<p>
Does this work
</p>
<br /><br />
<%
try
{ %>
<a id="acceptButton" >Accept</a>
<% }
catch
{%>
<a id="a1" >Accept</a>
<%} %>
</div>
</div>public ActionResult AcceptedDisclaimer(bool example)
{
var VideoView = new VideoViewModel();
var MediaInfo = new mobile_media_listMobile_media();
string URL;
string modelYear = "", vehicleName = "", topicID = "";
if (TempData["VideoView"] != null)
VideoView = (VideoViewModel)TempData["VideoView"];
if (TempData["snmvm"] != null)
VideoView.snmvm = (SubNavMenuViewModel)TempData["snmvm"];
if (TempData["MediaInfo"] != null)
MediaInfo = (mobile_media_listMobile_media)TempData["MediaInfo"];
if (TempData["modelYear"] != null)
modelYear = (string)TempData["modelYear"];
if (TempData["vehicleName"] != null)
vehicleName = (string)TempData["vehicleName"];
if (TempData["topicID"] != null)
topicID = (string)TempData["topicID"];
TempData.Remove("VideoView");
TempData.Remove("snmvm");
TempData.Remove("MediaInfo");
TempData.Remove("modelYear");
TempData.Remove("vehicleName");
TempData.Remove("topicID");
var topics = new TopicsViewModel(modelYear, vehicleName, topicID);
if (Request.UserAgent.ToUpper().Contains(WebConfigurationManager.AppSettings["BlackberryAgent"]))
{
URL = MediaLibrary.GetPlatformURL(WebConfigurationManager.AppSettings["3gpPlatform"], MediaInfo);
if (!String.IsNullOrEmpty(URL)) return Redirect(URL);
}
else
{
return View("Video", VideoView);
}
return View(topics);
}