Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to make datagrid searchable?

How to make datagrid searchable?

Scheduled Pinned Locked Moved ASP.NET
csharpcsstutorialquestion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rock Star
    wrote on last edited by
    #1

    Hi, I am new in .net. I am making an application using datagrid which is showing details about employees. So I want to make my data grid searchable. So i am using a textbox where user can enter some data into it and the matching result with all the columns will be displayed in the datagrid. If anyone knows how to do it or anyone hav a code for it. Please reply me

    Rocki Star

    P N J 3 Replies Last reply
    0
    • R Rock Star

      Hi, I am new in .net. I am making an application using datagrid which is showing details about employees. So I want to make my data grid searchable. So i am using a textbox where user can enter some data into it and the matching result with all the columns will be displayed in the datagrid. If anyone knows how to do it or anyone hav a code for it. Please reply me

      Rocki Star

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      You can try the following methods 1- When user enters search criteria, goto database and fetch the records and rebind the DataGrid. 2- When datagrid is initially binded, keep datasource in a session or viewstate, and do search on that datasource. If you are using DataTable to bind the grid, you can use Select() method to search the records.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      R 1 Reply Last reply
      0
      • R Rock Star

        Hi, I am new in .net. I am making an application using datagrid which is showing details about employees. So I want to make my data grid searchable. So i am using a textbox where user can enter some data into it and the matching result with all the columns will be displayed in the datagrid. If anyone knows how to do it or anyone hav a code for it. Please reply me

        Rocki Star

        P Offline
        P Offline
        Prateek G
        wrote on last edited by
        #3

        Search for the same in your dataset or datatable and display particular row... For doing the same you can loop through all the rows present in ur datasource(dataset or wotever u r using)

        1 Reply Last reply
        0
        • N N a v a n e e t h

          You can try the following methods 1- When user enters search criteria, goto database and fetch the records and rebind the DataGrid. 2- When datagrid is initially binded, keep datasource in a session or viewstate, and do search on that datasource. If you are using DataTable to bind the grid, you can use Select() method to search the records.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

          R Offline
          R Offline
          Rock Star
          wrote on last edited by
          #4

          Actually I am planning for that it will search for the criteria in all the column in datagrid. Search criteria is not restricted to only one column. So is there any method or event in datagrid which can help me. http://www.preterra.com/flexsamples/gridsearch/gridsearch.html[^] This is how one guy has achieved it using datagrid but he hasn't uploaded his code Is it possible for me to do it in this style. Thank You N a v a n e e t h

          Rock Star

          N 1 Reply Last reply
          0
          • R Rock Star

            Actually I am planning for that it will search for the criteria in all the column in datagrid. Search criteria is not restricted to only one column. So is there any method or event in datagrid which can help me. http://www.preterra.com/flexsamples/gridsearch/gridsearch.html[^] This is how one guy has achieved it using datagrid but he hasn't uploaded his code Is it possible for me to do it in this style. Thank You N a v a n e e t h

            Rock Star

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            Rock Star. wrote:

            I am planning for that it will search for the criteria in all the column in datagrid.

            Yes you can do as I specified in the first post. Assume your DataGrid is binded with a DataTable object. DataTable comes with a select(DataTableObject.Select()) method where you can write queries. So form a query which looks for the matches in all the columns when user clicks search, pass it to the select method on the DataTable object. You can keep the DataTable object in Session/ViewState.

            All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

            1 Reply Last reply
            0
            • R Rock Star

              Hi, I am new in .net. I am making an application using datagrid which is showing details about employees. So I want to make my data grid searchable. So i am using a textbox where user can enter some data into it and the matching result with all the columns will be displayed in the datagrid. If anyone knows how to do it or anyone hav a code for it. Please reply me

              Rocki Star

              J Offline
              J Offline
              joemonvarghese
              wrote on last edited by
              #6

              hi if you are binding a dataset to the grid then it is very easy.... filter the dataset with the value entered in the text box dataset.select(

              N 1 Reply Last reply
              0
              • J joemonvarghese

                hi if you are binding a dataset to the grid then it is very easy.... filter the dataset with the value entered in the text box dataset.select(

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                joemonvarghese wrote:

                if you are binding a dataset to the grid then it is very easy.... filter the dataset with the value entered in the text box dataset.select(

                WRONG. Dataset don't have Select() method.

                All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups