none
aplicacion mvc RRS feed

  • Pregunta

  • hola, estoy haciendo una aplicacion MVC en visual basic y con una base de datos entitie, la aplicacion es muy simple, pero no me aclaro con los controles el model y demas, la aplicacion muestra una lista de registros y cada uno de ello debe tener un editar, borrar, y visualizar adjunto una captura y mi codigo que no me funciona correctamente, de como debe ser, ¿alguien me puede dar un ejemplo de como realizarlo?

    este codigo es de la vista index

    @ModelType PagedList.IPagedList(Of CHJ.PozosSequia.Pozo)
    
    @Imports  PagedList.Mvc
    @Code
        ViewData("Title") = "Pozos"
    End Code
    
    <h2>Pozos de sequia</h2>
    
    @Using (Html.BeginForm())
    
        @<fieldset>
            <legend></legend>
            <p>
                @Html.TextBox("searchString", ViewBag.currentFilter, New With {.placeholder = "Texto a Buscar"})
                <input type="submit" value="Buscar" class="boton" />
            </p>
            <br />
            <table>
                <tr>
    
                    <th>
                        @Html.ActionLink("Nombre", "Index", New With {.sortOrder = ViewBag.order1, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("X_ETRS89_SPACP", "Index", New With {.sortOrder = ViewBag.order2, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Y_ETRS89_SPACP", "Index", New With {.sortOrder = ViewBag.order3, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("R_Catastral", "Index", New With {.sortOrder = ViewBag.order4, .currentFilter = ViewBag.CurrentFilter})
                    </th>
    
                    <th>
                        @Html.ActionLink("REF CATASTRAL FACILITADA POR ARJ", "Index", New With {.sortOrder = ViewBag.order5, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Cod_masa", "Index", New With {.sortOrder = ViewBag.order6, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Nom_masa", "Index", New With {.sortOrder = ViewBag.order7, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Titular según información D.T.", "Index", New With {.sortOrder = ViewBag.order8, .currentFilter = ViewBag.CurrentFilter})
                    </th>
    
                    <th>
                        @Html.ActionLink("DATOS FACILITADOS ACEQUIA REAL JUCAR", "Index", New With {.sortOrder = ViewBag.order9, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Titularidad Catastral", "Index", New With {.sortOrder = ViewBag.order10, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("ELECTRIFICADO SEGÚN INFORMACION ARJ", "Index", New With {.sortOrder = ViewBag.order11, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("DOCUMENTOS AFECTOS A LA TITULARIDAD ( SEGÚN EXPEDIENTES COMISARIA)", "Index", New With {.sortOrder = ViewBag.order12, .currentFilter = ViewBag.CurrentFilter})
                    </th>
    
                    <th>
                        @Html.ActionLink("Documentación", "Index", New With {.sortOrder = ViewBag.order13, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Sector", "Index", New With {.sortOrder = ViewBag.order14, .currentFilter = ViewBag.CurrentFilter})
                    </th>
    
                    <th>
                        @Html.ActionLink("Municipio", "Index", New With {.sortOrder = ViewBag.order15, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Provincia", "Index", New With {.sortOrder = ViewBag.order16, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("Ref_local", "Index", New With {.sortOrder = ViewBag.order17, .currentFilter = ViewBag.CurrentFilter})
                    </th>
                    <th>
                        @Html.ActionLink("promotor", "Index", New With {.sortOrder = ViewBag.order18, .currentFilter = ViewBag.CurrentFilter})
                    </th>
    
    
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
    
                @For Each item In Model
                    @<tr>
    
                        <td>
                            @Html.DisplayFor(Function(modelItem) item.nombre)
                        </td>
                        <td>
                            @Html.DisplayFor(Function(modelItem) item.xEtrs89Spacp)
                        </td>
                        <td>
                            @Html.DisplayFor(Function(modelItem) item.yEtrs89Spacp)
                        </td>
                        <td>
                            @Html.DisplayFor(Function(modelItem) item.rCatastral)
                        </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.rCatastralARJ)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.codMasa)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.nomMasa)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.titularDT)
                         </td>
    
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.datosAcequiaRealJucar)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.titularidadCatastral)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.electrificadoARJ)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.documentosTitularidad)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.documentación)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.id_sector)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.codigoMunicipio)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.codigoProvincia)
                         </td>
    
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.refLocal)
                         </td>
                         <td>
                             @Html.DisplayFor(Function(modelItem) item.promotor)
                         </td>
    
    
                        <td>@Html.ActionLink("Details", "Details", New With {.id = item.IdInformacionPublica}, New With {.class = "boton_ver"})</td>
                        <td>@Html.ActionLink("Edit", "Edit", New With {.id = item.IdInformacionPublica}, New With {.class = "boton_editar"})</td>
                        <td>@Html.ActionLink("Delete", "Delete", New With {.id = item.IdInformacionPublica}, New With {.class = "boton_borrar"})</td>
                    </tr>
                Next
    
            </table>
            Page @IIf(Model.PageCount < Model.PageNumber, 0, Model.PageNumber) of @Model.PageCount
            @Html.PagedListPager(Model, Function(page) Url.Action("Index",
                                                 New With {page, .sortOrder = ViewBag.CurrentSort, .bReferencia = ViewBag.bReferencia, .bReferenciaS = ViewBag.bReferenciaS, .bReferenciaC = ViewBag.bReferenciaC, .bInteresado = ViewBag.bInteresado, .bMunicipio = ViewBag.bMunicipio, .bProvincia = ViewBag.bProvinciaS, .bAsunto = ViewBag.bAsunto, .bSituacion = ViewBag.bSituacionS, .bAlerta = ViewBag.bAlertaS, .bFecha = ViewBag.bFecha}))
    
            <div class="divBotonera">
                <input type="submit" name="boton" value="Nuevo" class="boton" />
            </div>
        </fieldset>
    End Using
    

    me da error en el campo item. de cada fila

    @Html.DisplayFor(Function(modelItem) item.promotor)

    y me gustaria un listado asi:                  

    con un ejemplo que haga lo mismo tambien me vale, no he realizado ninguna aplicacion mvc y no se que se pone en controler, models, views etc

    un saludo y muchas gracias

    martes, 16 de enero de 2018 17:16