TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raju Fodse
1.5k
244
31.5k
List view in MVC with Date Parameter
Sep 10 2018 12:10 AM
I am new in MVC. I want list view to generate by passing Date Parameter in controller; But I got error please help me solve the problem. my controller code is
LPDBContext DB =
new
LPDBContext();
var items = db.Processes.Where(x =>x.PRDate.ToShortDateString().Equals(08 / 09 / 2018)).ToList();
return
View(items);
My List View code is
@model IEnumerable
<
EasyApp.Models.Process
>
@{
ViewBag.Title
=
"ExportP3List"
;
Layout
=
"~/Views/Shared/_Layout.cshtml"
;
}
<
div
class
=
"EasyViewDiv table-responsive"
>
<
h2
>
Cutting
</
h2
>
<
table
style
=
"font-size:smaller;"
class
=
"table table-bordered"
>
<
tr
>
<
th
>
Production Date
</
th
>
<
th
>
In-Out Time
</
th
>
<
th
>
Employer
</
th
>
<
th
>
Operator Name
</
th
>
<
th
>
WO No
</
th
>
<
th
>
OD
</
th
>
<
th
>
Thk
</
th
>
<
th
>
Specification
</
th
>
<
th
>
Pipe No
</
th
>
<
th
>
Length
</
th
>
<
th
>
MT
</
th
>
<
th
>
Actual Meter
</
th
>
<
th
>
Time Taken
</
th
>
<
th
>
Speed
</
th
>
</
tr
>
@foreach (var item in Model)
{
<
tr
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PRDate)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.Atten.INTIME) TO @Html.DisplayFor(
modelItem
=
>
item.Atten.OUTIME)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.Atten.Emp.CompanyID)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.Atten.Emp.EmpName)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PipeAl.Order.WONO)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PipeAl.Order.DIA)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PipeAl.Order.THK)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PipeAl.Order.PISPEC)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PIPENO)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PipeAl.LENGTH)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.PipeAl.MT)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.ActualMeter)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.CuttingTime)
</
td
>
<
td
>
@Html.DisplayFor(
modelItem
=
>
item.CuttingSpeed)
</
td
>
</
tr
>
}
</
table
>
</
div
>
I got following error
LINQ to Entities does not recognize the method 'System.String ToShortDateString()' method, and this method cannot be translated into a store expression.
Reply
Answers (
6
)
i have error there is no row at position 0
Open PDF file in Jquery Dialoags