here is my fiddle https://blazorfiddle.com/s/d15hrars
I have a select component that changes the class of a table. there is also a button that can set the selected value of the select component. but pressing the button does not update the selected value in the drop down (the select component)
so pressing the button highlights the row San Jose but does not update the drop down. not sure why
parent component
#page "/"
<table class="table table-sm table-bordered table-striped">
<thead>
<tr>
<th>City</th>
</tr>
</thead>
<tbody>
#foreach (string c in Cities)
{
<tr class="#GetClass(c)">
<td>#c</td>
</tr>
}
</tbody>
</table>
<SelectFilter values="#Cities"
title="#SelectTitle"
#bind-SelectedValue="SelectedCity"/>
<button class="btn btn-primary"
#onclick="#(() => SelectedCity = "San Jose")">
Change
</button>
#functions {
string[] Cities = new string[] { "New York", "Los Angeles", "Denver", "San Jose" };
public string SelectedCity { get; set; }
public string GetClass(string city) =>
SelectedCity == city ? "bg-info text-white" : "";
[Parameter]
public string SelectTitle { get; set; }
}
child component
<div class="form-group">
<label for="select-#Title">#Title</label>
<select name="select-#Title"
class="form-control"
#onchange="HandleSelect"
value="#SelectedValue"
#attributes="Attrs">
<option disabled selected>Select #Title</option>
#foreach (string val in Values)
{
<option value="#val" selected="#(val == SelectedValue)">#val</option>
}
</select>
</div>
#code {
[Parameter]
public IEnumerable<string> Values { get; set; } = Enumerable.Empty<string>();
public string SelectedValue { get; set; }
[Parameter]
public string Title { get; set; } = "Placeholder";
[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object> Attrs { get; set; }
[Parameter]
public EventCallback<string> SelectedValueChanged { get; set; }
public async Task HandleSelect(ChangeEventArgs e)
{
SelectedValue = e.Value as string;
await SelectedValueChanged.InvokeAsync(SelectedValue);
}
}
Your child component is missing a Parameter attribute.
[Parameter]
public string SelectedValue { get; set; }
Related
In my class I have below
public int recordref { get; set; }
[DisplayFormat(ConvertEmptyStringToNull = false)]
[Required]
public string disty { get; set; }
[DisplayFormat(ConvertEmptyStringToNull = false)]
[Required]
public string country { get; set; }
public int claim_year { get; set; }
public int claim_month { get; set; }
[DisplayFormat(ConvertEmptyStringToNull = false)]
public string claim_no { get; set; }
[DisplayFormat(ConvertEmptyStringToNull = false)]
[Required]
public string partner { get; set; }
//[DisplayFormat(ConvertEmptyStringToNull = false)]
public string sp_mdf_number { get; set; }
public decimal original_claim_amount { get; set; }
//[DisplayFormat(ConvertEmptyStringToNull = false)]
public string description { get; set; }
public DateTime date_created { get; set; }
public string created_by { get; set; }
public DateTime date_updated { get; set; }
public string updated_by { get; set; }
and my RAZOR page is as below.
#page "/adddebtor/{CurrentID}"
#page "/adddebtor"
#using BlazorAppDashboard.Data
#inject DebtorService ObjDebtorService
#using Blazored.Typeahead;
#inject NavigationManager NavigationManager
<h3>Add Debtor</h3>
<EditForm Model="#objDebtor" OnValidSubmit="#SaveDebtor">
<DataAnnotationsValidator />
<ValidationSummary />
<table>
<tr>
<td>Disty</td>
<td>
<select #bind="#objDebtor.disty">
<option value="-1"></option>
#if (objDisties != null)
{
#foreach (var disty in objDisties)
{
<option value="#disty.disty_name">#disty.disty_name</option>
}
}
</select>
</td>
</tr>
<tr>
<td>Country</td>
<td>
<select #bind="#objDebtor.country">
<option value="-1"></option>
<option value="AU">AU</option>
<option value="NZ">NZ</option>
</select>
</td>
</tr>
<tr>
<td>Claim Year</td>
<td><input for="Name" #bind="#objDebtor.claim_year" /></td>
</tr>
<tr>
<td>Claim Month</td>
<td><input for="Name" #bind="#objDebtor.claim_month" /></td>
</tr>
<tr>
<td>Claim No</td>
<td><input for="Name" #bind="#objDebtor.claim_no" /></td>
</tr>
<tr>
<td>Partner</td>
<td>
<input type="text" list="textsearch" #bind-value="#objDebtor.partner" #bind-value:event="oninput" #onkeyup="autoComplete" />
<datalist id="textsearch">
#if (partners != null)
{
#foreach (var pt in partners)
{
<option value="#pt.partner">#pt.partner</option>
}
}
</datalist>
</td>
</tr>
<tr>
<td>SP/MDF No</td>
<td><input for="Name" #bind="#objDebtor.sp_mdf_number" /></td>
</tr>
<tr>
<td>Original Claim Amount</td>
<td><input for="Name" #bind="#objDebtor.original_claim_amount" /></td>
</tr>
<tr>
<td>Description</td>
<td><input for="Name" #bind="#objDebtor.description" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="Save" /> <input type="button" #onclick="#CancelSave" value="Cancel" />
#ErrorMessage
</td>
</tr>
</table>
</EditForm>
#code {
[Parameter]
public string CurrentID { get; set; }
public string ErrorMessage { get; set; }
BlazorAppDashboard.Data.Debtors objDebtor = new BlazorAppDashboard.Data.Debtors();
List<BlazorAppDashboard.Data.Disties> objDisties = new List<Disties>();
string temp_partner = "";
protected override async Task OnInitializedAsync()
{
if (CurrentID != null)
{
objDebtor = await Task.Run(() => ObjDebtorService.GetDebtorByRef(Convert.ToInt32(CurrentID)));
}
objDisties = await Task.Run(() => ObjDebtorService.getDistyList());
}
protected void SaveDebtor()
{
ErrorMessage = "";
ReturnData rd = new ReturnData();
rd = ObjDebtorService.Create(objDebtor, Convert.ToInt32(CurrentID));
if (rd.status == 1)
{
NavigationManager.NavigateTo("debtorslist");
}
else
{
ErrorMessage = "Error.Unable to save." + rd.error;
}
}
protected void CancelSave()
{
NavigationManager.NavigateTo("debtorslist");
}
//autofill partner code
private List<Partner> partners;
protected override void OnInitialized()
{
DebtorService partnerdataservice = new DebtorService();
}
private async Task<List<Partner>> autoComplete()
{
DebtorService partnerdataservice = new DebtorService();
partners = await Task.FromResult(partnerdataservice.getPartners(objDebtor.partner));
return partners;
}
//end autofill code
}
When I submit the form, it won't convert null values to empty strings and give me SQL errors.
I do not wish to check each field one by one when I pass parameters to SQL. My parameters are below.
cmd.Parameters.AddWithValue("#disty", debtors.disty);
cmd.Parameters.AddWithValue("#country", debtors.country);
cmd.Parameters.AddWithValue("#claim_year", debtors.claim_year);
cmd.Parameters.AddWithValue("#claim_month", debtors.claim_month);
cmd.Parameters.AddWithValue("#claim_no", debtors.claim_no);
cmd.Parameters.AddWithValue("#partner", debtors.partner);
cmd.Parameters.AddWithValue("#status", "Pending");
cmd.Parameters.AddWithValue("#sp_mdf_number", debtors.sp_mdf_number);
cmd.Parameters.AddWithValue("#description", debtors.description);
cmd.Parameters.AddWithValue("#original_claim_amount", debtors.original_claim_amount);
cmd.Parameters.AddWithValue("#created_by", "User Name");
Why am I still getting the below error
Error.Unable to save.The parameterized query '(#recordref int,#disty nvarchar(16),#country nvarchar(2),#claim_' expects the parameter '#claim_no', which was not supplied.
As an example #claim_no field is not entered (no value typed in the box) in the blazor view and it should convert to empty string ?
I don't think it's that inconvenient to just do a null check. It's only 5 characters more, and I think it will be easier to debug than to have some auto behavior filled in somewhere else:
Method One: Null Coalesce
If your SQL table's column is not nullable, and you really want to insert an empty string:
cmd.Parameters.AddWithValue("#claim_no", debtors.claim_no ?? ""); // null coalesce
Method 2: Submit Null Value to SQL
If your column is nullable, but you can't figure out how to pass a null value, try something like (you might have to tweak it, I'm at work and can't test rn):
cmd.Parameters.AddWithValue("#claim_no", debtors.claim_no ?? DBNull.Value);
Also, I VERY (VERY!) highly recommend using Dapper, so you can just list all the parameters you want in new { ID = debtors.ID, claim= . . . } and so on. I usually avoid NuGet Packages, but I consider this one pretty essential if you're doing any database work. I use many dozens of queries in my current site, and Dapper has saved me probably hours of my precious time.
i have selectList with multiple attr which is filled through cascading(on select a company i just show selected Company Models) Now i want to allow user to select multiple models such that on select, item should add in c# list and display in page and then allow user to select more of any other company.Picture attached
Following is my code.
OrderViewModel
public class OrderViewModel
{
[Display(Name ="Order ID")]
public int order_id { get; set; }
[Required]
public string cus_name { get; set; }
public string cus_phone { get; set; }
public System.DateTime Date { get; set; }
[DataType(DataType.Date)]
public System.DateTime Date { get; set; }
public int Amount { get; set; }
public List<Products> Products { get; set; }
}
i want to bind selected Item in 'Products' List of OrderViewModel which will be send to server with Further fields.
Products
public class Products
{
public int id { get; set; }
public int modelId { get; set; }
public int Phoneid { get; set; }
public int Quantity { get; set; }
public double price { get; set; }
public bool isSelected { get; set; }
public int order_id { get; set; }
}
Razor View
<div class="form-group row">
<label class="control-label col-6">Company Name</label>
<div class="col-12">
<select id="CompanyId" class="custom-select mr-sm-2"
asp-items="#(new SelectList( #ViewBag.Companies,"Phoneid","Com_name"))">
<option value="">Please Select</option>
</select>
</div>
<span class="text-danger"></span>
</div>
<div class="form-group row">
<label class="control-label col-6"></label>
<div class="col-12">
<select id="modelId" multiple class="custom-select mr-sm-2"
asp-items="#(new SelectList(string.Empty,"modelId","model_name","--Select--"))">
<option value="">Please Select</option>
</select>
</div>
<span class="text-danger"></span>
</div>
what i have tried yet to add item in list
<script>
$("#modelId").change(function () {
var list = #(Model.Products);
let item = $(this).children("option:selected").val();
list.forEach(x => {
if (x.modelId != item) {
#{
Products products = new Products()
{
isSelected=true,
modelId= item,
};
Model.Products.Add(products);
}
}
});
})
#for (int i = 0; i < Model.Products.Count; i++)
{
}
</script>
I display all selected product throught partial view now i just want to send these selected products along with Quanity and Price of each to Server
Here is a working demo like below:
Model:
public class Model
{
[Key]
public int modelId { get; set; }
[Display(Name = "Model Name")]
public string model_name { get; set; }
public int Phoneid { get; set; }
public IList<Products> Products { get; set; }
}
public class Company
{
[Key]
public int Phoneid { get; set; }
[Display(Name = "Company Name")]
public string Com_name { get; set; }
}
public class Products
{
public int id { get; set; }
public int modelId { get; set; }
public int Phoneid { get; set; }
public int Quantity { get; set; }
public double price { get; set; }
public bool isSelected { get; set; }
public int order_id { get; set; }
}
View(Index.cshtml):
#model Products
<div>
<div style="float:left;width:40%">
<form id="form">
<div class="form-group row">
<label>Company Name</label>
<div class="col-12">
<select id="CompanyId" asp-for="Phoneid" class="custom-select mr-sm-2"
asp-items="#(new SelectList( #ViewBag.Companies,"Phoneid","Com_name"))">
<option value="">Please Select</option>
</select>
</div>
</div>
<div class="form-group row">
<label>Model Name</label>
<div class="col-12">
<select id="modelId" multiple class="custom-select mr-sm-2" name="modelId"
asp-items="#(new SelectList(string.Empty,"modelId","model_name","--Select--"))">
<option value="">Please Select</option>
</select>
</div>
</div>
<div>
<input type="button" id="saveBtn" value="Save" />
</div>
</form>
</div>
<div style="float:right;width:60%">
<h5>Products</h5>
<div id="products"></div>
</div>
</div>
#section Scripts
{
<script>
$(function () {
$('#CompanyId').change(function () {
var data = $("#CompanyId").val();
console.log(data);
$.ajax({
url: '/Home/GetModel?Phoneid=' + $("#CompanyId").val(),
type: 'Get',
success: function (data) {
var items = "<option value='0'>Select</option>";
$.each(data, function (i, item) {
items += "<option value='" + item.value + "'>" + item.text + "</option>";
});
$('#modelId').html(items);
}
})
});
$('#saveBtn').click(function () {
$.ajax({
url: '/Home/GetProduct?Phoneid=' + $("#CompanyId").val() + "&modelId=" + $('#modelId').val(),
type: 'Post',
success: function (data) {
$('#products').html(data);
}
})
})
})
</script>
}
Partial View(_Partial.cshtml):
#model IEnumerable<Products>
<table class="table">
<tbody>
#foreach (var item in Model)
{
<tr>
<td>check</td>
<td>
<input asp-for="#item.isSelected" />
</td>
<td>Product Id</td>
<td>
#Html.DisplayFor(modelItem => item.id)
</td>
</tr>
<tr>
<td>Quantity</td>
<td>
#Html.DisplayFor(modelItem => item.Quantity)
</td>
<td>Price</td>
<td>
#Html.DisplayFor(modelItem => item.price)
</td>
</tr>
}
</tbody>
</table>
Controller:
public class HomeController : Controller
{
private readonly MvcProj3Context _context;
public HomeController(MvcProj3Context context)
{
_context = context;
}
public IActionResult Index()
{
ViewBag.Companies = _context.Company.ToList();
return View();
}
public JsonResult GetModel(int Phoneid)
{
List<Model> model = new List<Model>();
model = (from m in _context.Model
where m.Phoneid == Phoneid
select m).ToList();
return Json(new SelectList(model, "modelId", "model_name"));
}
[HttpPost]
public IActionResult GetProduct(int Phoneid, string[] modelId)
{
var data = new List<Products>();
var ids = modelId[0].Split(',');
foreach(var item in ids)
{
var id = int.Parse(item);
//guess the modelA in CompanyA contains several products
var product = (from p in _context.Products
where p.Phoneid == Phoneid && p.modelId == id
select p).ToList();
foreach (var pro in product)
{
data.Add(pro);
}
}
return PartialView("_Partial", data);
}
}
Result:
CustomCssFields is null when going back to controller. I already set a constructor but it is still the same. I found some similar question MVC Model with a list of objects as property but it almost has the same code as mine.
MODEL
public class CompanyModelView
{
public CompanyModelView()
{
CustomCssFields = new List<CompanyCssReferenceModelView>();
}
[BsonId]
public string _id { get; set; }
[BsonElement("CompanyName")]
[DisplayName("Company Name")]
public string CompanyName { get; set; }
[BsonElement("CompanyCode")]
[DisplayName("Company Code")]
public string CompanyCode { get; set; }
[BsonElement("CompanyConnectionString")]
[DisplayName("Company Connection String")]
public string CompanyConnectionString { get; set; }
[BsonElement("CargowiseVersion")]
[DisplayName("Cargowise Version")]
public string CargoWiseVersion { get; set; }
[BsonElement("CustomCssFields")]
[UIHint("CustomCssFields")]
public IList<CompanyCssReferenceModelView> CustomCssFields { get; set; }
}
public class CompanyCssReferenceModelView
{
[BsonElement("FieldName")]
public CssOptionEnum FieldName;
[BsonElement("FieldValue")]
public string FieldValue;
}
VIEW
here is the view.
#model WebTrackerModels.CompanyModels.CompanyModelView
<form asp-action="SaveCompany" enctype="multipart/form-data">
<div class="form-group">
<table class="table">
<thead>
<tr>
<th>
Field Name
</th>
<th>
Field Value
</th>
</tr>
</thead>
<tbody>
#{
for (int i = 0; i < Model.CustomCssFields.Count; i++)
{
<tr>
<td>
#Html.DisplayFor(model => model.CustomCssFields[i].FieldName)
</td>
<td>
#Html.TextBoxFor(model => model.CustomCssFields[i].FieldValue, new { #class = "form-control", type = "color", value = Model.CustomCssFields[i].FieldValue })
</td>
</tr>
}
}
</tbody>
</table>
</div>
<div class="form-group">
<input type="submit" value="Save" class="btn btn-success" />
</div>
</form>
Below is the Model
public class M_ProjectType
{
public Int16 ProjectTypeID { get; set; }
public String ProjectType { get; set; }
public Boolean IsActive { get; set; }
public Decimal Cost { get; set; }
public String Description { get; set; }
public Boolean IsChecked { get; set; }
}
Below is View Model
public class VM_Project
{
public string[] SkillID { get; set; }
public List<M_ProjectType> ProjectType { get; set; }
}
Below is Get Action method. here I am getting the data for projects that will be sent to View Model
[HttpGet, Route("Project")]
public async Task<ActionResult> Project()
{
var projectTypes = (await _projectTypes.ProjectTypesList()).Value;
var list = new List<M_ProjectType>();
foreach (var item in projectTypes)
{
list.Add(new M_ProjectType
{
Cost = item.Cost,
Description = item.Description,
IsActive = item.IsActive,
IsChecked = false,
ProjectType = item.ProjectType,
ProjectTypeID = item.ProjectTypeID
}
);
}
var project = new VM_Project
{
ProjectType = list
};
return View(project);
}
Below is Razor View
#foreach (var item in Model.ProjectType)
{
<table class="table table-striped">
<tbody>
<input type="hidden" value="#item.ProjectTypeID" name="ProjectTypeID" />
<tr>
<td style="width:5%">
#Html.CheckBoxFor(i => item.IsChecked, new { #class = "tableflat" })
#Html.HiddenFor(i => item.ProjectTypeID)
</td>
<td style="width:10%">#item.ProjectType</td>
<td style="width:80%">#item.Description</td>
<td style="width:5%"><b>$#item.Cost</b></td>
</tr>
</tbody>
</table>
}
Below is Post Action Method
[HttpPost, Route("Project")]
public ActionResult Project(VM_Project project)
{
return View();
}
Question: I am getting project.ProjectType = null. Any suggestion why
this is happening ?
I would recommend using EditorTemplates.
Create a folder named EditorTemplates in you Views/Shared direcotry.
Create a partial view based on your type i.e. M_ProjectType.cshtml
Put your markup that you use in foreach loop in M_ProjectType.cshtml file
#model M_ProjectType
<table class="table table-striped">
<tbody>
<tr>
<td style="width:5%">
#Html.CheckBoxFor(i => i.IsChecked, new { #class = "tableflat" })
#Html.HiddenFor(i => i.ProjectTypeID)
</td>
<td style="width:10%">#Model.ProjectType
#Html.HiddenFor(i=>i.ProjectType)
</td>
<td style="width:80%">#Model.Description</td>
<td style="width:5%"><b>$#Model.Cost</b></td>
</tr>
</tbody>
Then render your editor template in your form like (note: no foreach loop)
#Html.EditorFor(m=>m.ProjectType)
You should get correct model binded to your html elements back in controller.
Try this:
#foreach (var item in Model.ProjectType)
{
<table class="table table-striped">
<tbody>
<tr>
<td style="width:5%">
#Html.CheckBoxFor(i => item.IsChecked, new { #class = "tableflat" })
#Html.HiddenFor(i => item.ProjectTypeID, new { #Value = item.ProjectTypeID})
</td>
</tr>
</tbody>
</table>
}
I have two model and I want to show in one view. So I'm using
#Html.Partial
This is my first Model.
public partial class graduandModel :BaseNopEntityModel
{
public graduandModel()
{
this.AvailableCeremony = new List<SelectListItem>();
}
public string first_name { get; set; }
public string middle_name { get; set; }
public string last_name { get; set; }
public int student_id { get; set; }
public int ceremony_id { get; set; }
public DateTime ceremony_date { get; set; }
public int graduand_id { get; set; }
public IList<SelectListItem> AvailableCeremony { get; set; }
public graduandDegreeModel graduandDegreeGroup { get; set; }
}
This is my second Model.
public class graduandDegreeModel
{
public graduandDegreeModel()
{
this.AvailableDegree = new List<SelectListItem>();
}
public string degree_id { get; set; }
public int graduand_id { get; set; }
public string degree_name { get; set; }
public IList<SelectListItem> AvailableDegree { get; set; }
}
This is mu controller
public ActionResult CheckData(int ceremony_id, string first_name, string middle_name, string last_name)
{
graduandModel model = new graduandModel();
graduandDegreeModel model_1 = new graduandDegreeModel();
var graduandList = _graduandService.GetGraduandByStudent(ceremony_id, first_name, middle_name, last_name);
if (graduandList.Count != 0)
{
model.ceremony_id = ceremony_id;
model.first_name = first_name;
model.middle_name = middle_name;
model.last_name = last_name;
// var degreeList = "";
foreach (var c in graduandList)
{
var degreeList = _graduandDegreeService.getAllDegreeIdBtGraduandId(c.graduand_id);
foreach (var d in degreeList)
{
model_1.AvailableDegree.Add(new SelectListItem() { Text = d.Degree.degree_name, Value = d.degree_id });
}
}
}
return View(model);
}
This is my views
#{
Layout = "~/Views/Shared/_ColumnsThree.cshtml";
}
#model graduandModel
#using Nop.Web.Models.Hire;
#using Nop.Web.Framework;
#using Telerik.Web.Mvc.UI;
#using System.Linq;
#using (Html.BeginForm())
{
<table >
<tr>
<td >
Ceremony :
</td>
<td>
Ceremony at #Model.ceremony_date
</td>
</tr>
<tr>
<td >
Name :
</td>
<td >
#Model.first_name #Model.middle_name #Model.last_name
</td>
</tr>
</table>
<div>
#Html.Partial("_DegreeDetailsByGraduand", Model.graduandDegreeGroup)
</div>
}
This is my Partial view
#{
Layout = "~/Views/Shared/_ColumnsThree.cshtml";
}
#model graduandDegreeModel
#using Nop.Web.Models.Hire;
#using Nop.Web.Framework;
#using Telerik.Web.Mvc.UI;
#using System.Linq;
<table >
<tr>
<td >
AAAAAA
</td>
<td>
#Html.DropDownListFor(model => model.degree_id, Model.AvailableDegree)
#* #Html.ValidationMessageFor(model => model.ceremony_id)*#
</td>
</tr>
</table>
there is error
The model item passed into the dictionary is of type 'Nop.Web.Models.Hire.graduandModel', but this dictionary requires a model item of type 'Nop.Web.Models.Hire.graduandDegreeModel'.
How can I slove it???
You didn't create an instance for graduandModel's graduandDegreeGroup property. So this line:
#Html.Partial("_DegreeDetailsByGraduand", Model.graduandDegreeGroup)
will throw an exception like you said. Simply because the second parameter is NULL.
You can try to modify graduandModel's constructor as below:
public graduandModel()
{
this.AvailableCeremony = new List<SelectListItem>();
this.graduandDegreeGroup = new graduandDegreeModel();
}
The exception should be gone.
You may also find this link helpful: ASP.NET MVC renderpartial, model item passed into the dictionary is of type
Another option for you may be to create a new view model which combines the two models above into one. That way it has properties for all of the data you require for this view. Then you don't need to specify a model in your call to the partial view, it will automatically use the parent's model. Alternatively, you may not need to separate the view into partials at all with the use of a combined model. It is not uncommon to have a unique view model for each different view. In some applications, it can be rare that two different views require the same data.
The combined view model:
public class CheckDataViewModel
{
public CheckDataViewModel ()
{
this.AvailableCeremony = new List<SelectListItem>();
this.AvailableDegree = new List<SelectListItem>();
}
public string first_name { get; set; }
public string middle_name { get; set; }
public string last_name { get; set; }
public int student_id { get; set; }
public int ceremony_id { get; set; }
public DateTime ceremony_date { get; set; }
public int graduand_id { get; set; }
public IList<SelectListItem> AvailableCeremony { get; set; }
public graduandDegreeModel graduandDegreeGroup { get; set; }
public string degree_id { get; set; }
public string degree_name { get; set; }
public IList<SelectListItem> AvailableDegree { get; set; }
}
The combined view:
#{
Layout = "~/Views/Shared/_ColumnsThree.cshtml";
}
#model CheckDataViewModel
#using Nop.Web.Models.Hire;
#using Nop.Web.Framework;
#using Telerik.Web.Mvc.UI;
#using System.Linq;
#using (Html.BeginForm())
{
<table >
<tr>
<td >
Ceremony :
</td>
<td>
Ceremony at #Model.ceremony_date
</td>
</tr>
<tr>
<td >
Name :
</td>
<td >
#Model.first_name #Model.middle_name #Model.last_name
</td>
</tr>
</table>
<div>
<table >
<tr>
<td >
AAAAAA
</td>
<td>
#Html.DropDownListFor(model => model.degree_id, Model.AvailableDegree)
#* #Html.ValidationMessageFor(model => model.ceremony_id)*#
</td>
</tr>
</table>
</div>
}