Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a situation where I fetch around 10 Records from database and displays them into a templated GridView control but it takes a lot of time on each click (as I fetch records at each time the next or previous button is clicked).

Also how can I achieve this from Ajax without postback. Any ideas for gzipping the DB output are also welcome.

Thanks

EDIT: Adding text from authors comment

Hi following is the HTML Code of the Grid Templated :

ASP.NET
<asp:GridView ID="Grd_ShowOffers" runat="server" Width="100%" AutoGenerateColumns="False" HorizontalAlign="Center" OnPageIndexChanging="Grd_ShowOffers_PageIndexChanging" BorderColor="transparent" BorderWidth="0" RowStyle-BorderColor="transparent"> 
<asp:TemplateField> 
<div class="search-result" style="padding-removed5px; text-align:center; width:99%;padding-removed3px; padding-removed10px; padding-removed5px;"> 
<table width="100%" border="0" cellpadding="5" cellspacing="5"> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> 
<tr> 
<td style="width:16%;" valign="top">
<table width="116" border="0" cellspacing="5" cellpadding="0"> 
<tr> 
<td style="width:20px;" valign="top">
 <asp:CheckBox ID="Chk_Title" runat="server" /> 
</td> 
<td style="width:81px;" valign="top" align="left"> 
<img alt=" " id="Img3" src="images/featured-tag.gif" style='<%# GetFeaturedImageVisibility(Eval("Featured"), Eval("ImagePath1"))%>'/> 
<img alt="" id="Img_Title" src='<%#Eval("ImagePath1") %>' style="position:absolute;z-index:9999;" width="78" height="82" border="0" /> 
</td> 
</tr> 
<tr> 
<td colspan="2"> 
</td> 
</tr> 
</table></td></tr></table></td></tr></table></div>
Posted
Updated 2-Dec-11 2:18am
v2
Comments
thatraja 2-Dec-11 3:10am    
Is paging enabled for that Gridview?
Ashish Dev1 2-Dec-11 5:36am    
I am fetching next 10 records from database on each click of next or previous buttons.
D K N T H 2-Dec-11 3:46am    
may we see you codes?
Karthik Harve 2-Dec-11 3:48am    
ya, paste some code.. may be coding could be the cause..!!!
Ashish Dev1 2-Dec-11 5:09am    
Hi following is the HTML Code of the Grid Templated :

<asp:GridView ID="Grd_ShowOffers" runat="server" Width="100%" AutoGenerateColumns="False" HorizontalAlign="Center"
OnPageIndexChanging="Grd_ShowOffers_PageIndexChanging" BorderColor="transparent" BorderWidth="0" RowStyle-BorderColor="transparent">
<columns>
<asp:TemplateField>
<itemtemplate>

<div class="search-result" style="padding-bottom:5px; text-align:center; width:99%;padding-left:3px; padding-top:10px; padding-right:5px;">
<table width="100%" border="0" cellpadding="5" cellspacing="5">
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="width:16%;" valign="top"><table width="116" border="0" cellspacing="5" cellpadding="0">
<tr>
<td style="width:20px;" valign="top"><span class="form11">
<asp:CheckBox ID="Chk_Title" runat="server" />
</span></td>
<td style="width:81px;" valign="top" align="left">

<img alt=" " id="Img3" src="images/featured-tag.gif" style='<%# GetFeaturedImageVisibility(Eval("Featured"), Eval("ImagePath1"))%>'/>
<img alt="" id="Img_Title" src='<%#Eval("ImagePath1") %>' style="position:absolute;z-index:9999;" width="78" height="82" border="0" />

</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>

1 solution

Still you didn't give us complete code, check this answer

Gridview paging[^]
 
Share this answer
 
Comments
Ashish Dev1 2-Dec-11 8:36am    
Thanks, Well Actually I am using Grid(with Item template) as shown above. I have implemented custom Paging (I fetch Data from database on each click of Next or Previous Button). My basic problem is that suppose I have two Buttons & first loads first 10 records and second 10-20 Records from database.

I guess that if I have simple Grid then it'll load very fast as compare to Templated Grid. Is there any technique to make the template grid fast?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900