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 Fill GridView Fast

How to Fill GridView Fast

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestionworkspace
5 Posts 5 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.
  • M Offline
    M Offline
    Manish_Kumar_Nayak
    wrote on last edited by
    #1

    I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?

    A A B R 4 Replies Last reply
    0
    • M Manish_Kumar_Nayak

      I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      res.manish wrote:

      I have bulk of data of client information aprox 15000.

      This is not an good idea to showing this amount of data In gridview at time. What you can do 1. Use Filter Criteria and based on that allow to retrieve Data. Because, there is no sense to load 15,000 at a time, as no one going to check those data at time. So, use filter criteria. 2. Use Caching, To Reduce the performance hit. If the data is common for all user, use dataCaching, use filter from Cached data itself. Use Cache Dependency if you want to update cache if some changes in data. Hope this will help you !

      1 Reply Last reply
      0
      • M Manish_Kumar_Nayak

        I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?

        A Offline
        A Offline
        Anurag Gandhi
        wrote on last edited by
        #3

        Apart from Abhijit's suggestion you may also wish to consider one or more of other methods of displaying data. Some of them are: Paging, Grouping of Records, Pivoting, or using Graphs or charts. The main idea is just don't dump a lot of data to the client browser. Secondly, user can analyse the data if the number of rows are lesser.

        Anurag Gandhi.
        http://www.gandhisoft.com
        Life is a computer program and every one is the programmer of his own life.

        1 Reply Last reply
        0
        • M Manish_Kumar_Nayak

          I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?

          B Offline
          B Offline
          Brij
          wrote on last edited by
          #4

          As Anurag & Abhijit suggested,use some filter criteria.If there is no criteria then use paging.Also it'll be better if you do the paging at databse level itself.

          Cheers!! Brij

          1 Reply Last reply
          0
          • M Manish_Kumar_Nayak

            I have bulk of data of client information aprox 15000. When I Fill this data to GridView it takes too much time. 1. Fill data with sqldatasource. 2. Fill datatable and bind with GridView. To fill data with datatable to get data I use this code - SqlConnection cnSql = new SqlConnection(strConn); cnSql.Open(); SqlCommand cmd = new SqlCommand(StrSql, cnSql); cmd.CommandTimeout = 50000; cmd.ResetCommandTimeout(); SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); is there any problem with my code or I have to change some configuration in my web.config ?

            R Offline
            R Offline
            R Giskard Reventlov
            wrote on last edited by
            #5

            You could alos try a third paty control such as the Infragistics UltraWebGrid[^] which has a LoadOnDemand capability and is pretty simple to use. Here: Load On Demand in WebGrid 2[^]. An old article but you get the idea.

            Tychotics: take us back to the moon "Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars." H. G. Wells

            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