How obtain value of hotel in Controller ? now i have only null. The nested object are not allowed because of html 5 doesn't let to be nested. I have objects in template but only object knight bring the value and I need also further written controls values. I ve tried to put the object but without formater yet, but I dont think it has meaning now.
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Add knight</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" th:href="#{/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css}" />
<script th:src="#{/webjars/jquery/3.2.1/jquery.min.js}"></script>
<script th:src="#{/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js}"></script>
</head>
<body>
<div class="container">
<form class="form-horizontal" th:object="${knight}" th:action="#{/assignQuest}" th:method="post">
<input type="hidden" th:field="*{id}"/>
<input type="hidden" th:field="*{name}"/>
<input type="hidden" th:field="*{age}"/>
<input type="hidden" th:field="*{level}"/>
<div class="form-group">
<label class="control-label">Wykonaj zadanie</label>
<select th:field="*{quest}">
<option th:each="quest : ${notStartedQuests}"
th:value="${quest.id}"
th:text="${quest.description}">?</option>
</select>
</div>
<input type="hidden" th:field="*{name}"/>
<input type="hidden" th:field="*{id}"/>
<ul>
<label class="control-label">Zamiesszkaj w hotelu</label>
<li th:each="hotel : ${hotels}">
<input type="radio" th:field="*{id}" th:value="${hotel.id}" />
<label th:for="${hotel.name}" th:text="${hotel.name}"></label>
</li>
</ul>
<div class="row">
<button type="submit" class="btn btn-default">Wyslij rycerza</button>
</div>
</form>
</div>
</body>
</html>
QuestController:
import java.util.List;
#Controller
public class QuestController {
#Autowired
KnightService knightService;
#Autowired
QuestService questService;
#Autowired
HotelService hotelService;
#RequestMapping("/assignQuest")
public String assignQuest(#RequestParam("knightId") Integer id, Model model) {
Knight knight = knightService.getKnight(id);
List<Quest> notStartedQuests = questService.getAllNotStartedQuests();
List<Hotel> hotels = hotelService.getAllHotels();
model.addAttribute("knight", knight);
model.addAttribute("notStartedQuests", notStartedQuests);
model.addAttribute("hotels", hotels);
return "assignQuest";
}
#RequestMapping(value = "/assignQuest", method = RequestMethod.POST)
public String assignQuest(Knight knight, Hotel hotels, BindingResult result) {
System.out.println(result);
System.out.println(hotels);
knightService.updateKnight(knight);
// Quest quest = knight.getQuest();
// questService.update(quest);
return "redirect:/knights";
}
}
Related
I am very new to AngularJS and trying to understand how AngularJS can use along with ASP.NET-MVC5 application. In my first attempt I want to run AngularJS app from basic HTML page (in my case index.html) where app holding form template in html format, also I have add global variable, controller, service via factory and directives but I cannot manage to run this app 'employee-form' inside index.html. In order to test if angularJS is initialize and working properly, I have added very basic angularjs code inside in html and it works.. I am not sure where I have done mistake
AngularFormsApp.js (global variable)
var angularFormsApp = angular.module('angularFormsApp', []);
efController.js
angularFormsApp.controller('efController',
function efController($scope, efService) {
$scope.employee = efService.employee;
});
efService.js
angularFormsApp.factory('efService',
function () {
return {
employee: {
fullName: "Khurram Zahid",
notes: "The ideal employee, just don't mess with him",
department: "IT Development",
perkCar: true,
perkStock: false,
perkSixWeeks: true,
payrollType: "none"
}
}
});
efDirective.js
angularFormsApp.directive('employeeForm',
function () {
return {
restrict: 'E', //E stands for element, meaning we want to use this directive as element
templateUrl: '~/App/EmployeeForm/efTemplate.html'
}
});
efTemplate.html (form)
<div class="form-group">
<label for="fullName">Name</label>
<input type="text" id="fullName" name="fullName" class="form-control" />
</div>
<div class="form-group">
<label for="notes">Notes</label>
<input type="text" id="notes" name="notes" class="form-control" />
</div>
<div class="form-group">
<label for="department">Department</label>
<select id="department" name="department" class="form-control">
<option>Engineering</option>
<option>Marketing</option>
<option>Finance</option>
<option>IT Development</option>
</select>
</div>
<br/>
<span><b>Perks</b></span>
<div class="checkbox">
<label><input type="checkbox" value="perCar"/>Company Car</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="perkStock" />perk Stock</label>
</div>
<div class="checkbox">
<label><input type="checkbox" value="perkSixWeeks" />perk Six Weeks</label>
</div>
<input type="submit" value="Submit Form" />
index.html
<!DOCTYPE html>
<html>
<head >
<title>Angular JS</title>
<link href="Content/bootstrap.min.css" rel="stylesheet" />
<script src="Scripts/angular.min.js"></script>
<script src="App/AngularFormsApp.js"></script>
<script src="App/EmployeeForm/efController.js"></script>
<script src="App/EmployeeForm/efService.js"></script>
<script src="App/EmployeeForm/efDirective.js"></script>
</head>
<body ng-app="angularFormsApp">
<div class="AngularJSTestBlockCode">
<div>
<input type="text" ng-model="name" />
<br />
<h1>Hello {{name}}</h1>
</div>
<br /><br />
<div>
{{458/8}}
</div>
</div>
<div>-------------------------------------------------------</div> <br/><br/>
<div ng-controller="efController">
<employee-form>????????????????????
</div>
You need a route provider to render your html page. Here is your example
.config(['$stateProvider',function($stateProvider) {
$stateProvider.state('dashboard', {
url:'/dashboard',
templateUrl: 'views/dashboard/main.html',
})
.state('dashboard.create-example',{
templateUrl:'views/example/create.html',
url:'/create-example',
controller:'Ctrl'
})
then in your controller(efController.js) put this $state.transitionTo('dashboard.create-example'); to render your page to any html you want
I'm new to MVC so I'm not completely sure that I have the model tied into the controller and view as it should be. I'm trying to have a message pop up after an error has occured. In this case the error occurs after the submit button has been clicked.
The view...
#if (ViewBag.Message != null)
{
<script>
$(document).ready(function () {
alert('#ViewBag.Message');
});
</script>
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guru Dental: Request Demo</title>
<!-- CSS -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,400">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Sans">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lobster">
<link rel="stylesheet" href="~/Content/assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="~/Content/assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="~/Content/assets/css/animate.css">
<link rel="stylesheet" href="~/Content/assets/css/magnific-popup.css">
<link rel="stylesheet" href="~/Content/assets/flexslider/flexslider.css">
<link rel="stylesheet" href="~/Content/assets/css/form-elements.css">
<link rel="stylesheet" href="~/Content/assets/css/style.css">
<link rel="stylesheet" href="~/Content/assets/css/media-queries.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Favicon and touch icons -->
<link rel="shortcut icon" href="~/images/favicon.ico" type="image/x-icon">
<link rel="icon" href="~/images/favicon.ico" type="image/x-icon">
</head>
<body>
<!-- Top menu -->
<nav class="navbar" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#top-navbar-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<br>
<img class="logo-size" src="~/images/guru-dental-slogan.png" alt="">
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="top-navbar-1">
<ul class="nav navbar-nav navbar-right">
<li><a href='#Url.Action("Index", "Home")'><br><br>Home</a></li>
<li>
<a href='#Url.Action("Contact", "Home")'><br><br>Contact</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Page Title -->
<div class="page-title-container">
<div class="container">
<div class="row">
<div class="col-sm-12 wow fadeIn">
<h1>Demo Request</h1>
</div>
</div>
</div>
</div>
<!-- Contact Us -->
<div class="contact-us-container">
<div class="container">
<div class="row">
<div class="col-sm-7 contact-form wow fadeInLeft">
#using (Html.BeginForm("DemoSubmit", "CRM", FormMethod.Post))
{
<h2>Rep Details</h2>
<div class="form-group">
<label for="contact-firstname">HSD Rep Code</label>
<input type="text" name="hsdrepcode" placeholder="Enter your HSD Rep code..." class="contact-name" id="contact-name">
</div>
<div class="form-group">
<label for="contact-lastname">Rep First Name</label>
<input type="text" name="hsfirstname" placeholder="Enter your Rep first name..." class="contact-name" id="contact-name">
</div>
<div class="form-group">
<label for="contact-lastname">Rep Last Name</label>
<input type="text" name="hslastname" placeholder="Enter your Rep last name..." class="contact-name" id="contact-name">
</div>
<h2>Doctor Details</h2>
<div class="form-group">
<label for="contact-currentlocation">Doctor's First Name</label>
<input type="text" name="firstname" placeholder="Enter your doctor's first name.." class="contact-subject" id="contact-subject">
</div>
<div class="form-group">
<label for="contact-currentlocation">Doctor's Last Name</label>
<input type="text" name="lastname" placeholder="Enter your doctor's last name..." class="contact-subject" id="contact-subject">
</div>
<div class="form-group">
<label for="contact-currentlocation">Doctor's Phone Number</label>
<input type="text" name="phonenumber" placeholder="Enter your doctor's phone number..." class="contact-subject" id="contact-subject">
</div>
<div class="form-group">
<label for="contact-currentlocation">Doctor's E-mail</label>
<input type="text" name="emailaddress" placeholder="Enter your doctor's e-mail..." class="contact-subject" id="contact-subject">
</div>
<button type="submit" class="btn">Submit</button>
}
</div>
The controller...
public ActionResult RequestDemo()
{
return View();
}
[HttpPost]
public ActionResult DemoSubmit(LeadInfo leadInfo)
{
string salesEmail = CRMModels.GetNextSalesEmail();
ViewBag.Message = CRMModels.AddLeadToCRM(leadInfo);
if (ViewBag.Message == null)
{
EmailModels.SendEmailForLead(leadInfo, salesEmail);
return RedirectToAction("Index", "Home");
}
else
return RequestDemo();
}
}
The model...
if (hsdRepId != Guid.Empty)
{
lead.Attributes["ree_hsdrepresentative"] = new EntityReference("ree_henryscheinrepresentative", hsdRepId);
service.Create(lead);
}
else
{
message = "Invalid HSD Representative Code";
}
return message;
In the DemoSubmit function, if there is a message to display, I need to go back to the view to display it. How do I do that? I tried to do with a redirect but that just gives me a new page with none of the data that was entered in and it didn't display the message.
Thanks,
Gary
On controller once you got error you can add error message to modalState
ModelState.AddModelError("", "Invalid HSD Representative Code");
and to pop the error alert you can use html extension method to pop the message
public static HtmlString PopAlert(this HtmlHelper htmlHelper, string alertType = "danger",
string heading = "")
{
if (htmlHelper.ViewData.ModelState.IsValid)
return new HtmlString(string.Empty);
var sb = new StringBuilder();
sb.AppendFormat("<div class=\"alert alert-{0} alert-block\">", alertType);
sb.Append("<button class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">×</button>");
if (!heading.IsNullOrWhiteSpace())
{
sb.AppendFormat("<h4 class=\"alert-heading\">{0}</h4>", heading);
}
sb.Append(htmlHelper.ValidationSummary());
sb.Append("</div>");
return new HtmlString(sb.ToString());
}
On view you simply call the Html extension method like this
#Html.PopAlert()
hope this will help you :)
You have a number of problems with your code, in particular the fact you not binding any controls to you model so returning the view will always display empty controls. You should also include validation attributes on you properties to prevent posting and saving potentially bad data. Your view is also generating invalid html (lots of duplicate id attributes) and <label> tags which are not really labels (clicking on them wont set focus to the associated control because you don't associate them with a control.
Based on your view, your LeadInfo class looks something like (suggested attributes added)
public class LeadInfo
{
[Display(Name = "HSD Rep code")]
[Required(ErrorMessage = "Please enter your HSD Rep code")]
public string hsdrepcode { get; set; }
[Display(Name = "Rep first name")]
[Required(ErrorMessage = "Please enter your Rep first name")]
public string hsfirstname { get; set; }
.....
[Display(Name = "Doctor's e-mail")]
[Required(ErrorMessage = "Please enter your doctor's e-mail")]
[EmailAddress]
public string emailaddress{ get; set; }
}
You GET method should then be
public ActionResult RequestDemo()
{
LeadInfo model = new LeadInfo();
return View(model);
}
and the view should then strongly typed html helpers to bind to your properties and to display validation errors
#model LeadInfo
....
#using(Html.BeginForm())
{
#Html.AntiForgeryToken()
#Html.ValidationSummary(true) // this is where you custom error message will be displayed
#Html.LabelFor(m => m.hsdrepcode) // displays the text associated with the DisplayAttribute and is associated with the following textbox
#Html.TextBoxFor(m => m.hsdrepcode, new { placeholder="Enter your HSD Rep code...", #class="contact-name"})
#Html.ValidationMessageFor(m => m.hsdrepcode)
....
<button type="submit" class="btn">Submit</button>
}
You should also include the following scripts (preferably using #Scripts.Render() and the bundling and minification features of MVC)
jquery-{version}.js
jquery.validate.js
jquery.validate.unobtrusive.js
You should also be using layouts (master pages)
The post method is then
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult RequestDemo(LeadInfo model) // not sure why you would change the name of the method?
{
if(!ModelState.IsValid)
{
return View(model); // return the view to fix any validation errors
}
string errorMessage = CRMModels.AddLeadToCRM(leadInfo);
if (errorMessage == null)
{
string salesEmail = CRMModels.GetNextSalesEmail();
EmailModels.SendEmailForLead(leadInfo, salesEmail);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", errorMessage);
return View(model);
}
}
Its not clear what the error message you want to return is, but you code suggests it might be associated with the hsdrepcode property, in which case, modify the code to associate the error with a particular property
ModelState.AddModelError("hsdrepcode", errorMessage);
Side note: Most of your code is ignoring the benefits of using MVC, to the point you may as well not use it. I recommend you go the the MVC site and work through the tutorials,
I have problem with update foreign key in a instance of my domain class Semester. I'm new in Groovy Grails. When I create new Semester everything is ok.
Semester.groovy
class Semester {
int name
Season season
}
Season.groovy
class Season {
String name
}
SemesterController.groovy
SemesterController{
def update(){
def semester = Semester.get(params.id)
semester.name = params.semester
semester.season = params.season // Here is a problem !!
semester.save(flush: true)
redirect(uri: "/semester/index")
}
}
edit.gsp
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="bootstrap-main" />
<title>SARNA</title>
</head>
<body>
<br />
<div class="container">
<g:form class="form-horizontal" role="form"
url="[resource:semester, controller: 'Semester']">
<label for="semester" class="col-sm-2 control-label">Semestr</label>
<g:textField class="form-control" name="semester"
value="${semester.name}" />
<g:select name="season" from="${com.sarna.entity.Season.list()}" optionKey="id"
optionValue="name" value="${semester?.season?.id}"/>
<g:actionSubmit class="btn btn-primary" value="Zapisz"
action="update" />
</g:form>
</div>
</body>
</html>
When I'm trying save changes I have this Exception:
URI: /SARNA/semester/index/1
Class: java.lang.IllegalStateException
Message: Cannot convert value of type [java.lang.String] to required type [com.sarna.entity.Season] for property 'season': no matching editors or conversion strategy found
What am I doing wrong ? Could you help me? Thanks
Make the following changes to the form
<g:form class="form-horizontal" role="form"
url="[resource:semester, controller: 'Semester']">
<g:hiddenField name="id" value="${semester.id}"/>
<label for="semester" class="col-sm-2 control-label">Semestr</label>
<g:textField class="form-control" name="name" value="${semester.name}" />
<g:select name="season.id" from="${com.sarna.entity.Season.list()}" optionKey="id"
optionValue="name" value="${semester?.season?.id}"/>
<g:actionSubmit class="btn btn-primary" value="Zapisz"
action="update" />
</g:form>
You can then simplify your action to:
SemesterController{
def update(Semester semester){
semester.save(flush: true)
redirect(uri: "/semester/index")
}
}
I'm at a beginner with ASP.NET MVC 4 and I have a problem. Basically I have this controller:
public ViewResult Login()
{
return View(new LoginViewModel());
}
[HttpPost]
public ActionResult Login(LoginViewModel model)
{
if (ModelState.IsValid)
{
if (authProvider.Authenticate(model.LoginUserName, model.LoginPassword))
{
return Redirect(Url.Action("Index", "Home"));
}
TempData["message"] = "Nome utente e/o password errati!!!";
return View();
}
return View();
}
That implements a simple login view. I created also a ViewModel:
public class LoginViewModel
{
[Required(ErrorMessage = "Il nome utente è obbligatorio")]
[UIHint("TextBoxLogin")]
public string LoginUserName { get; set; }
[Required]
public string LoginPassword { get; set; }
}
Finally I created the EditorTemplate:
#model string
<input name="#ViewData.TemplateInfo.HtmlFieldPrefix" id="#ViewData.TemplateInfo.HtmlFieldPrefix"data-validation="required" data-validation-error-msg="#ViewData["HelpMessage"]" value="#Model" />
So far so good. The problem is in the view. If I put this in the view:
#using(Html.BeginForm()) {
#Html.ValidationSummary(true)
#Html.EditorForModel()
<p><input type="submit" value="Log in" /></p>
}
It works like a charm (but it puts a lot of not wanted html into the page), in fact, when I click on the submit button it goes to the POST actionResult of the controller. If I put this:
#using (Html.BeginForm("Login","Account",FormMethod.Post))
{
<p class="username">
<label for="UserName">Nome utente</label>
#Html.EditorFor(m => m.LoginUserName, new { HelpMessage = "Il nome utente è obbligatorio!!!" });
</p>
<p class="password">
<label for="Password">Password</label>
#Html.EditorFor(m => m.LoginPassword)
</p>
<p>
<input type="submit" value="Log in" />
</p>
}
It does not go on the post actionresult but always on the Get one. I want to put this type of code (the last one) in wich I can setup exactly the html but I want that it goes on the POST Actionresult, can someone help me to understand why?
-----------------update----------------
Here is the HTML generated:
<!doctype html>
<html lang="it">
<head>
<meta charset="utf-8">
<title>Title</title>
<meta name="robots" content="noindex,nofollow" />
<link href="/static/css/login.css" rel="stylesheet" type="text/css" />
<link href="/static/css/jquery_ui.css" rel="stylesheet" type="text/css" />
<!--[if lt IE 9]><link href="/static/css/lt_ie9.css" rel="stylesheet" type="text/css" /><![endif]-->
<script src="/static/js/jquery_1_10_2.js"></script>
<script src="/static/js/jquery_ui.js"></script>
<script src="/static/js/jquery_ui_function.js"></script>
</head>
<body>
<form>
<div id="top">
<div class="wrapped">
<div id="logo">TITLE</div>
</div>
</div>
<div id="content" class="user_student">
<div class="wrapped">
<div class="login_intro">
<h2>TEST</h2>
</div>
<div class="login_input">
<p id="error_messages"></p>
<h2>THIS ONE MAKES GET REQUEST</h2>
<form action="/Account/Login" method="post"> <p class="username"><label for="UserName">Nome utente</label>
<!--<input id="UserName" name="UserName" type="text"/>-->
<input name="LoginUserName" id="LoginUserName"data-validation="required" data-validation-error-msg="Il nome utente è obbligatorio!!!" />;
</p>
<p class="password"><label for="LoginPassword">Password</label>
<input class="text-box single-line" data-val="true" data-val-required="Il campo LoginPassword è obbligatorio." id="LoginPassword" name="LoginPassword" type="text" value="" />
</p>
<p><input type="submit" value="Log in" /></p>
</form> <p class="hidden">old</p>
</div>
<div class="login_footer">
<p>FOOTER</p>
</div>
</div>
</div>
<h2>THIS ONE MAKE POST REQUEST</h2>
<form action="/Account/Login?ReturnUrl=%2f" method="post"><div class="editor-label"><label for="LoginUserName">LoginUserName</label></div>
<div class="editor-field"><input name="LoginUserName" id="LoginUserName"data-validation="required" data-validation-error-msg="" /> <span class="field-validation-valid" data-valmsg-for="LoginUserName" data-valmsg-replace="true"></span></div>
<div class="editor-label"><label for="LoginPassword">LoginPassword</label></div>
<div class="editor-field"><input class="text-box single-line" data-val="true" data-val-required="Il campo LoginPassword è obbligatorio." id="LoginPassword" name="LoginPassword" type="text" value="" /> <span class="field-validation-valid" data-valmsg-for="LoginPassword" data-valmsg-replace="true"></span></div>
<p><input type="submit" value="Log in" /></p>
</form><script src="/static/form-validator/jquery.form-validator.min.js"></script>
<script src="/static/js/jquery_form_validator_function.js"></script>
</form>
</body>
</html>
Finally I figured out what is the problem...and of course it is the most stupid thing in the world.
In the rended code there is a open just after the body and, inside it, the form that MVC put from razor view.
Thanks for everyone for the help paricularly to #DavidG
I am developing the MVC application.
I have designed the login form.
when user enters the proper username and password then, it redirect to next page, but when user put wrong username or password I want to display the message on the login form, how to do it.
This is the code of method in controller...
[HttpPost]
public ActionResult LoginUser(FormCollection oFormCollection)
{
string userName = oFormCollection["username"];
string password = oFormCollection["password"];
bool IsAccountPerson = false;
var validEmployee = (from e in db.Employees
where e.UserName == userName && e.Password == password
select e).ToList();
if (validEmployee.Count() == 1)
{
foreach (var v in validEmployee)
{
oEmployee = v;
Session["LoggedEmployee"] = oEmployee;
Session["loggedEmpId"] = oEmployee.Id;
if (oEmployee.DesignationType == "Account")
{
IsAccountPerson = true;
}
else
{
IsAccountPerson = false;
}
}
if(IsAccountPerson)
return RedirectToAction("PaymentAdviceListForAccounts", "Account");
else
return RedirectToAction("Index", "PaymentAdvice");
}
else
return PartialView("Index");
}
and this is my view Code....
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link href="#Url.Content("~/Content/bootstrap.css")" rel="stylesheet" type="text/css" />
<title></title>
</head>
#using (Html.BeginForm("LoginUser","Login",FormMethod.Post))
{
#*<div style="margin:15% 20% 20% 30%; width:35%;min-height:25%;border:1px #ACACAC solid;">*#
<div class="container-fluid" style="padding-left:0px; margin-top:165px; margin-left:140px;">
<div class ="span3">
<label style="font-size:15px; color:#666666; margin-top:5px;">Username</label>
</div>
<div class ="span6">
<input type="text" id="username" name="username" style="height:20px; width:100%;" />
</div>
<div class ="span3">
<label style="font-size:15px;color:#666666; margin-top:5px; ">Password</label>
</div>
<div class ="span6">
<input type="password" id="password" name="password" style="height:20px; width:100%;"/>
</div>
<div class="span6" style="padding-left:15px;">
<input type="submit" name="submit" value="Login" class="btn btn-primary" style="margin-right:10px; height:30px; font-size:14px; width:55px;" />
<input type="button" name="Login" value="Cancel" class="btn btn-primary" style="margin-right:20px; height:30px; font-size:14px; width:55px; padding-left:5px; padding-right:5px;" />
</div>
</div>
</div>
</div>
</div>
}
</body>
</html>
create new model or use TempData.
here is the example using TempData.
http://www.devcurry.com/2012/05/what-is-aspnet-mvc-tempdata.html