Perfomance with grid view

Posted by Venu510 under ASP.NET on 7/27/2011 | Points: 10 | Views : 1201 | Status : [Member] | Replies : 7
Hi Friends!

I have been asked by a question in one interview.

Q:If my gridview page is displaying 100 records /page and it have 10 pages meas the total records are 1000 ,how can you handle it?


this is the question can any one give answer pls

Thanks & Regards
------------
VEnu




Responses

Posted by: A4u_6178 on: 7/27/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Venu510,
You can use paging in gridview and set pagesize as 10.
I hope i understood ur question correctly and answered...

Thanks & Regards,

Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Venu510 on: 7/27/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks for your replay this is not the answer if i wish to display 10 records/page every time when i click on paging numbers it will execute query and will give 1000 records then obviously there is performance degradation.I think you got my point




Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A4u_6178 on: 7/27/2011 [Member] Starter | Points: 25

Up
0
Down
hi venu510,
I was not clear about ur question and so i put (I hope i understood ur question correctly and answered...
)
anyways.. to avoid queriying data oftenly from database on paging do onething when u retrieve data from database u can use sessions , caching to store the records... and when u need to bind it again after pageindex change bind the records from the sessioned or cached recordset

Thanks & Regards,

Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vijayar on: 7/27/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
You can using paging for a gridview and specify the number of records to be displayed ;
protected void gvSourceInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

gvSourceInfo.PageIndex = e.NewPageIndex;

} where gvsourceinfo is grid name

vijaya

Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Umeshdwivedi on: 7/27/2011 [Member] Starter | Points: 25

Up
0
Down
Hallo
Then main concern of the interviewer is performance issue with Gridview paging. Because if you are using Gridview paging then it will be very costly in terms of memory. Because all records save in memory and can be performance issue. So simple answer is, in this case we will use
-Always use Sql Reader to bind the gridview
- Implement paging on Sql server side. Do not use Gridview paging.
i hope you understand

Latest Technology Trainer
And Part time software consultant

Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Venu510 on: 7/28/2011 [Member] Starter | Points: 25

Up
0
Down
HI Umeshdwivedi!

Thanks for your replay could you provide any example link wich explains me more


Regards
------
Venu

Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Umeshdwivedi on: 7/28/2011 [Member] Starter | Points: 25

Up
0
Down
hallo
i found this link
this link is best for your query
and if you really want to know that so read carefully and trying to example
http://www.asp.net/data-access/tutorials/efficiently-paging-through-large-amounts-of-data-cs

Latest Technology Trainer
And Part time software consultant

Venu510, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response