I am trying to create a label text using html helper from my model RoomAvailabilitySummary
View Design:
@model IEnumerable<WBE.Model.RoomAvailabilitySummary>
@using(Ajax.BeginForm("RoomsAvail", new AjaxOptions
{
UpdateTargetId = "RoomsAvailData",
InsertionMode = InsertionMode.Replace
}))
{
@Html.AntiForgeryToken()
<div class="container paddingzero">
<div class="row rowbackground">
@Html.DisplayFor(model => model.ARRDAT)
</div>
<div class="row rowbackground">
@Html.EditorFor(model => model.ARRDAT)
</div>
<div class="row rowbackground">
@Html.DisplayFor(model => model.DEPDAT)
</div>
<div class="row rowbackground">
@Html.EditorFor(model => model.DEPDAT)
</div>
</div>
}
<div class="tab-content" id="RoomsAvailData">
@Html.Partial("_AvailableRoomsandPackages", Model);
</div>
Controller:
public class RoomAvailabilitySummary
{
[Key]
public int CUSTCODE { get; set; }
[Display(Name = "Checkin")]
public string ARRDAT { get; set; }
[Display(Name = "Check out")]
public string DEPDAT { get; set; }
}
Problem: I am unable to create label text using my model with html helper.
Error i am getting: IEnumerable' does not contain a definition for 'ARRDAT' and no extension method 'ARRDAT' accepting a first argument of type IEnumerable
What i have done the mistake in my code?
I have done the following changes in my design and its working as expected.
@Html.Partial("_BookingInputs")
<div class="tab-content" id="RoomsAvailData">
@Html.Action("AvailableInventory", "Bookings");
</div>
<div id="Loading" class="Loading">
</div>