How to correct this error, and I was able to see this other table in my view?

0

I need to make a select with two tables and throw the result to a PagedList . But when I do the query, it returns the error:

  

Can not implicitly convert type 'PagedList.IPagedList' to 'PagedList.IPagedList

asked by anonymous 09.06.2015 / 15:22

2 answers

0

Dude, try this.

@model Sistema.Models.for
@{
  ViewBag.Title = "Consulta de Devedores";
}
@using PagedList.Mvc;
<h2>Consulta de Devedores</h2>
<div id="page-wrapper">
  <div class="content-wrapper">
    <div class="container-fluid">
        @using (Html.BeginForm("ConTitulos", "Devedores", FormMethod.Get))
        {
            <table width="100%">
                <tr>
                    <td class="tblNormal">Nº do Protocolo</td>
                </tr>
                <tr>
                    <td class="tblNormal">
                        <input type="text" name="NProtocolo" onkeypress="FiltraTecla(event);" size="10" maxlength="10" value="">
                        @*@Html.EditorFor(model => model.TIT_PRT_CRT, new { htmlAttributes = new { @class = "form-control", name= "NProtocolo",size = "10", maxlength = "10", value = "" } })*@
                    </td>
                </tr>
            </table>
            if (Model.ProcuraResultados != null && Model.ProcuraResultados.Count > 1)
            {
                <div>
                    <br />
                    <table class="table">
                        <tr>
                            <th>Devedor</th>
                            <th>Fornecedor</th>
                        </tr>
                        @foreach (var item in Model.ProcuraResultados)
                        {
                            <tr>
                                <td class="control-label">@item.Dev_nome</td>
                                <td class="control-label">@item.For_Nome</td>
                                <td>
                                    @Html.ActionLink("Alterar", "AltDevedor", new { id = @item.DEV_ID }, null)
                                </td>
                            </tr>
                        }
                    </table>
                </div>
                @Html.PagedListPager(Model, page => Url.Action("ConTitulos", new RouteValueDictionary()
      {
           { "Pagina", page },
           { "Apresentante", Model.Dev_nome },
           { "Devedor", Model.For_Nome }
      }),
      PagedListRenderOptions.PageNumbersOnly)
            }
        }
        </div>
    </div>
</div>
    
09.06.2015 / 15:56
0

This does not return List<for> :

var results = entities.For
            .Join(entities.Dev,
            t => t.For_Dev_ID,
            h => h.Dev_ID,
            (t, h) => new
            {
            t.For_Nome,
            h.Dev_Nome
            })
            .Where(b => b.Protocolo == NProtocolo).AsEnumerable();

This returns an anonymous object with two properties: For_Nome and Dev_Nome . This will conflict with what we have in View , so the error:

@model Sistema.Models.for

As you send a View a IPagedList , change to:

@using PagedList
@model IPagedList
    
09.06.2015 / 22:19