Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my form preview in razor

@model MVCSurvey.Models.UserMast

@{
ViewBag.Title = "Create";
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

Create



@using (Html.BeginForm())
{
@Html.AntiForgeryToken()


User Master




@Html.ValidationSummary(true)


@Html.LabelFor(model => model.uname,"User Name :", new { @class = "control-label col-md-2" })

@Html.TextBoxFor(model => model.uname,new { @class = "textb" })
@Html.ValidationMessageFor(model => model.uname)




@Html.LabelFor(model => model.password,"Password :", new { @class = "control-label col-md-2" })

@Html.PasswordFor(model => model.password,new { @class = "textb" })
@Html.ValidationMessageFor(model => model.password)




@Html.LabelFor(model => model.category,"Category :", new { @class = "control-label col-md-2" })

@Html.DropDownList("drptype", new[] {
new SelectListItem() {Text = "Admin",
Value = "1",Selected=true},
new SelectListItem() {Text = "General",
Value = "2" }
}, "Choose an option")
@Html.ValidationMessageFor(model => model.category)







<input type="submit" value="Create" class="buttom" />



}


@Html.ActionLink("Back to List", "Index")



There are 6 fields in usermast table
uname in the textbox value,password is the textbox value and category will be the
dropdown list value there are 3 fields which will be the bydefault 1 during data insert .can any one help me?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900