0
我在mvc4的幫助下創建了一個asp.net應用程序。我有8個文本字段。如何在asp.net MVC中的gridview中填充textfields的值
public class RegistrationModel
{
[Required(ErrorMessage = "Programme Name Missing")]
[Display(Name = "Name of the Programme")]
public string ProgrammeName { get; set; }
[Required(ErrorMessage = "Training Objective Missing")]
[Display(Name = "Objective of the Training")]
public string Objective { get; set; }
[Required(ErrorMessage = "Participants Missing")]
[Display(Name = "Participants/Target group")]
public string Participant { get; set; }
[Required(ErrorMessage = "Faculty Missing")]
[Display(Name = "Faculty")]
public string Faculty { get; set; }
[Required(ErrorMessage = "Date Missing")]
[Display(Name = "Date")]
public string Date { get; set; }
[Required(ErrorMessage = "Duration Missing")]
[Display(Name = "Duration(in hrs)")]
public string Duration { get; set; }
[Required(ErrorMessage = "Max.no.of.Participants Missing")]
[Display(Name = "Maximum no of Participants")]
public string MaximumParticipants { get; set; }
[Required(ErrorMessage = "Venue Missing")]
[Display(Name = "Venue")]
public string Venue { get; set; }
}
而且,這是.cshtml代碼: 我需要填充這些值
<ol> <li> @Html.LabelFor(m => m.ProgrammeName) @Html.TextBoxFor(m => m.ProgrammeName, new { maxlength = 50 }) @Html.ValidationMessageFor(m => m.ProgrammeName) </li> <li> @Html.LabelFor(m => m.Objective) @Html.TextBoxFor(m => m.Objective, new { maxlength = 500 }) @Html.ValidationMessageFor(m => m.Objective) </li> <li> @Html.LabelFor(m => m.Participant) @Html.TextBoxFor(m => m.Participant, new { maxlength = 50 }) @Html.ValidationMessageFor(m => m.Participant) </li> <li> @Html.LabelFor(m => m.Faculty) @Html.TextBoxFor(m => m.Faculty, new { maxlength = 30 }) @Html.ValidationMessageFor(m => m.Faculty) </li> <li> @Html.LabelFor(m => m.Date) @Html.TextBoxFor(m => m.Date) @Html.ValidationMessageFor(m => m.Date) </li> <li> @Html.LabelFor(m => m.Duration) @Html.TextBoxFor(m => m.Duration) @Html.ValidationMessageFor(m => m.Duration) </li> <li> @Html.LabelFor(m => m.MaximumParticipants) @Html.TextBoxFor(m => m.MaximumParticipants, new { maxlength = 5 }) @Html.ValidationMessageFor(m => m.MaximumParticipants) </li> <li> @Html.LabelFor(m => m.Venue) @Html.TextBoxFor(m => m.Venue, new { maxlength = 20 }) @Html.ValidationMessageFor(m => m.Venue) </li> </ol>
我困惑的是如何填充在網格視圖文本字段的值。