Populating datagrid columns from database after page has already loaded

I have a web page that loads some data using a SQL query into a datagrid. I was asked to add a new column. During testing, I found that pulling this extra column of data from the database slows down the query significantly. What used to take a subsecond request takes about 3-4 seconds. I have checked the database and all relevant indexes in place and changing the database here would not be practical.

Either way, slowing down page loading can really impact performance.

If possible and practical, this is what I would like to do. I would like to make the datagrid as before with the original query, but keep the extra column as well. Then, after rendering the page, use Ajax to go back to the server and get the data for the remaining column and populate it. This way, those users who don't need an extra column to do their job don't have to wait that long for the page to be rendered, but those who do need it can just wait a few seconds and the data will be there.

The problem is, I have no idea how to do this. Any suggestions?

+1


source to share


1 answer


Give the user the option to display an additional column or not. Then you have two queries that can bind to a GridView that returns an extra column and the other doesn't. The user then has to decide what kind of "look" they want. To prevent them from being resolved every time you open or refresh the page, you keep your choice.



0


source







All Articles