Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3992040
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:43:07+00:00 2026-05-20T06:43:07+00:00

I’m using MVC3 and webgrid on a system. I like to know if it’s

  • 0

I’m using MVC3 and webgrid on a system. I like to know if it’s possible to implement a search engine.

My controller has

Return View(service.list)

and return around 50000 records, so it will be nice to search something inside results.

Regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:43:08+00:00Added an answer on May 20, 2026 at 6:43 am

    I found the solution….

    The view (using Razor):

    @Using Html.BeginForm("ListarAsegurados", "PolizasLayout", New AjaxOptions With {.UpdateTargetId = "divGrid"})
        Dim varCondicionesDeBusqueda As IDictionary(Of String, String) = New Dictionary(Of String, String)
    
        If Not IsNothing(TempData("CondicionesDeBusqueda")) Then
            varCondicionesDeBusqueda = TryCast(TempData("CondicionesDeBusqueda"), Dictionary(Of String, String))
        End If
        TempData("CondicionesDeBusqueda") = varCondicionesDeBusqueda
        Dim varDocumentoAsegurado As String = If(varCondicionesDeBusqueda.Keys.Contains("DOCUMENTO_ASEGURADO"), varCondicionesDeBusqueda("DOCUMENTO_ASEGURADO"), String.Empty)
        Dim varNombresAsegurado As String = If(varCondicionesDeBusqueda.Keys.Contains("Asegurado"), varCondicionesDeBusqueda("Asegurado"), String.Empty)
    
        @<fieldset>
            <legend>Filtros de Búsqueda</legend>
            <table>
                <tr>
                    <td>
                        @Html.RadioButton("Grupo", "", True, New With {.class = "letraingreso", .style = "width:30px", .id = "RadioButton1", .onclick = "CambiarEstadoControles(this)"})
                    </td>
                    <td style="border-width:0px; width:120px">
                        @Html.Label("ID_TIPO_DOCUMENTO", "Tipo Documento:")
                    </td>
                    <td style="border-width:0px">
                        @Html.DropDownList("ID_TIPO_DOCUMENTO", Nothing, New With {.class = "letraingreso", .style = "width:250px"})
                    </td>
                    <td style="width:50px"></td>
                    <td style="border-width:0px">
                        @Html.Label("DOCUMENTO_ASEGURADO", "No. Documento:")
                        @Html.TextBox("DOCUMENTO_ASEGURADO", varDocumentoAsegurado, New With {.class = "letraingreso", .style = "width:200px", .onkeyup = "if(this.value.match(/\D/))this.value=this.value.replace(/\D/g,'')"})
                    </td>
                </tr>
                <tr>
                    <td>
                        @Html.RadioButton("Grupo", "", False, New With {.class = "letraingreso", .style = "width:30px", .id = "RadioButton2", .onclick = "CambiarEstadoControles(this)"})
                    </td>
                    <td style="border-width:0px; width:120px">
                        @Html.Label("Asegurado", "Apellidos / Nombres:")
                    </td>
                    <td style="border-width:0px">
                        @Html.TextBox("Asegurado", varNombresAsegurado, New With {.class = "letraingreso", .style = "width:400px; text-transform:uppercase", .disabled = "disabled"})
                    </td>
                </tr>
            </table>
    
            <br />
            <table>
                <tr>
                    <td style="border-width:0px; width:145px">
                        <input type ="submit" value="Buscar" style="width:90px" />
                    </td>
                </tr>
            </table>
        </fieldset>
    
    
        @<br />
        @<p>
            @Html.ActionLink(" ", "Create", "Asegurado", New With {.area = "Polizas"}, New With {.class = "imgNuevo"})
        </p>
    
    
        @<div id="divGrid">
            @grid.GetHtml(
                        tableStyle:="webgrid",
                        headerStyle:="webgrid-header",
                        footerStyle:="webgrid-footer",
                        alternatingRowStyle:="webgrid-alternating-row",
                        selectedRowStyle:="webgrid-selected-row",
                        rowStyle:="webgrid-row-style",
                        mode:=WebGridPagerModes.All,
                        firstText:="<< Inicio",
                        previousText:="< Anterior",
                        nextText:="Siguiente >",
                        lastText:="Fin >>",
                        columns:=grid.Columns(
                        grid.Column(format:=Function(Model) Html.ActionLink(" ", "Edit", "Asegurado", New With {.area = "Polizas", .parID = Model.ID_ASEGURADO}, New With {.class = "imgEditar", .title = "Modificar"}), style:="webgrid-width-images"),
                        grid.Column(format:=Function(Model) Html.ActionLink(" ", "Delete", "Asegurado", New With {.area = "Polizas", .parID = Model.ID_ASEGURADO}, New With {.class = "imgEliminar", .title = "Eliminar"}), style:="webgrid-width-images"),
                        grid.Column("DOCUMENTO_ASEGURADO", "No. Documento"),
                        grid.Column("PRIMER_APELLIDO_ASEGURADO", "Asegurado", format:=Function(Model) Model.PRIMER_APELLIDO_ASEGURADO & " " & Model.SEGUNDO_APELLIDO_ASEGURADO & " " & Model.NOMBRES_ASEGURADO),
                        grid.Column("DIRECCION_DOMICILIO_ASEGURADO", "Dirección"),
                        grid.Column("EMAIL_ASEGURADO", "eMail")
                        )
                        )
        </div>
    End Using
    

    Controller:

    Function ListarAsegurados() As ActionResult
            Dim varListado As SelectList
            Dim varCondicionesDeBusqueda As IDictionary(Of String, String) = New Dictionary(Of String, String)
    
            If Request.Form.AllKeys.Length > 0 Then
                varCondicionesDeBusqueda.Add("DOCUMENTO_ASEGURADO", Request("DOCUMENTO_ASEGURADO"))
                varCondicionesDeBusqueda.Add("Asegurado", Request("Asegurado"))
            Else
                Dim values As Object = Nothing
                If TempData.TryGetValue("CondicionesDeBusqueda", values) Then
                    varCondicionesDeBusqueda = TryCast(values, Dictionary(Of String, String))
                End If
            End If
    
            TempData("CondicionesDeBusqueda") = varCondicionesDeBusqueda
            Dim varDocumentoAsegurado As String = GetSearchConditionValue(varCondicionesDeBusqueda, "DOCUMENTO_ASEGURADO")
            Dim varNombresAsegurado As String = GetSearchConditionValue(varCondicionesDeBusqueda, "Asegurado")
    
            If String.IsNullOrEmpty(varDocumentoAsegurado) And String.IsNullOrEmpty(varNombresAsegurado) Then
                varListado = New SelectList(varServicio.ListarTiposDocumentos, "ID_TIPO_DOCUMENTO", "DESC_TIPO_DOCUMENTO")
                ViewData("ID_TIPO_DOCUMENTO") = varListado
    
                Return View(varServicio.ListarAsegurados)
            Else
                varListado = New SelectList(varServicio.ListarTiposDocumentos, "ID_TIPO_DOCUMENTO", "DESC_TIPO_DOCUMENTO", CLng(Request.Form("ID_TIPO_DOCUMENTO")))
                ViewData("ID_TIPO_DOCUMENTO") = varListado
    
                If String.IsNullOrEmpty(varDocumentoAsegurado) Then
                    Return View(varServicio.ListarAseguradosPorApellidosNombres(varNombresAsegurado))
                Else
                    Return View(varServicio.ListarAseguradosPorDocumento(CLng(varListado.Items(0).ID_TIPO_DOCUMENTO), varDocumentoAsegurado))
                End If
            End If
        End Function
    

    The function:

    Public Function GetSearchConditionValue(ByVal parCondicionesDeBusqueda As IDictionary(Of String, String), ByVal parClave As String) As String
        Dim varValorTemporal As String = String.Empty
    
        'If parCondicionesDeBusqueda IsNot Nothing AndAlso parCondicionesDeBusqueda.Keys.Contains("StudentName") Then
        If parCondicionesDeBusqueda IsNot Nothing Then
            parCondicionesDeBusqueda.TryGetValue(parClave, varValorTemporal)
        End If
        Return varValorTemporal
    End Function
    

    You can found the original post at http://www.cnblogs.com/jack86514/archive/2010/10/26/1861109.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.