.IPagedList <system.data.datatable>不包含剃刀视图中的列的定义asp.net mv

时间:2018-12-27 12:42:06

标签: model

我在数据表中使用服务器端分页,但发生错误ipagedlist不包含“列和行”的定义。 以下是我的代码所需的帮助

@model  PagedList.IPagedList<System.Data.DataTable>

 <div class="panel-body">
            <table id="table" class="table  table-condensed table-bordered table-hover  table-responsive table-striped">
                <thead>
                    <tr>
                        @foreach (DataColumn col in Model.Columns)
                        {
                            if (col.ColumnName != "Invoice" && col.ColumnName != "Tax")
                            {
                                <th>@col.ColumnName</th>
                            }


                        }
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>

                    @foreach (DataRow dr in Model.Rows)
                    {
                    <tr>
                        @foreach (DataColumn dc in Model.Columns)
                        {
                            if (dc.ToString() != "Invoice" && dc.ToString() != "Tax")
                            {
                                <td>
                                    @if (dc.ToString() == "Created Date")
                                    {
                                        string s = String.Format("{0:dd-MM-yyyy}", @dr[dc.ColumnName]);
                                        @s;
                                    }
                                    else
                                    {
                                        if (dc.ToString() == "Amount")
                                        {
                                            string s = String.Format("{0:F2}", @dr[dc.ColumnName]);
                                            @s
                                        }
                                        else
                                        {
                                            @dr[dc.ColumnName]
                                        }
                                    }
                                </td>
                            }
                        }
                        <td>
                            @Html.ActionLink("Edit", "Edit", new { id = @dr["Order Id"] }, new { @class = "btn-sm btn-primary" })
                            @Html.ActionLink("Details", "OrderDetails", new { id = @dr["Order Id"] }, new { @class = "btn-sm btn-info" })
                            @{
                                if ((dr["Invoice"]).ToString() == "1")
                                {
                                    @Html.ActionLink("Invoice", "ViewInvoice", new { id = @dr["Order Id"] }, new { @class = "btn-sm btn-success", @target = "_blank" })
                                }
                                else
                                {
                                    @Html.ActionLink("Invoice", "ViewInvoice", new { id = 0 }, new { @class = "btn-sm btn-default", @onclick = "javascript:return false;" })
                                }
                            }
                        </td>

                    </tr>
                    }
                </tbody>
            </table>

0 个答案:

没有答案