@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<
form
class
=
"form-horizontal"
method
=
"post"
>
<
h4
>Standard textbox:</
h4
>
@Html.TextBoxFor(m => m.Candidate.CandidateId)
<
h4
>Kendo textbox:</
h4
>
@Html.Kendo().TextBoxFor(model => model.Candidate.FirstName)
<
div
class
=
"form-group"
>
<
div
>
<
button
type
=
"submit"
class
=
"btn btn-default"
>Submit</
button
>
</
div
>
</
div
>
</
form
>
public
class
IndexModel : PageModel
{
[BindProperty]
public
CandidateViewModel Candidate {
get
;
set
; }
public
void
OnGet()
{
}
public
void
OnPost()
{
ViewData[
"firstname"
] = $
"{Candidate.FirstName}"
;
ViewData[
"candidateid"
] = $
"{Candidate.CandidateId}"
;
}
}
public
class
CandidateViewModel
{
[Key]
[Display(Name =
"Candidate ID"
)]
public
int
CandidateId {
get
;
set
; }
[Required]
[Display(Name =
"First Name"
)]
public
string
FirstName {
get
;
set
; }
}