Click here to Skip to main content
Click here to Skip to main content
Go to top

WebDataGridPaging Problem Solving

, 26 Feb 2006
Rate this:
Please Sign up or sign in to vote.
About web datagrid paging problem

Sample Image - 1.gif

Introduction

If you use webdatagrid on your web project think more than once. Because webdatagrid has got a lot of problems. For example; I used webdatagrid for search page. I am sending my keyword with querystring and catch this querystring on search.aspx. I have no problem from first step to this step. What the this step is ?? You guess Paging Problem....... When I execute my query from sqlclient it is working for first page but when i want to change another page it is gave errors. I started to think and also research all the internet about webdatagrid. And last i found my problem. This problems solved with traditional metots. My datagrid's code here:

<asp:datagrid id="dgBulunanListe" runat="server" DataKeyField="mutaalaid" AutoGenerateColumns="False"
GridLines="Vertical" CellPadding="4" BackColor="red" BorderWidth="0px" BorderStyle="None"
BorderColor="#000000" Width="950px" AllowPaging="True" ForeColor="#000000">
<SelectedItemStyle Font-Bold="True" ForeColor="#FFFFFF" BackColor="#CCCCCC"></SelectedItemStyle>
<AlternatingItemStyle BackColor="#FFFFFF"></AlternatingItemStyle>
<ItemStyle BackColor="#EBEBEB"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#CCCCCC"></HeaderStyle>
<FooterStyle BackColor="#CCCC99"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="MutaalaID" HeaderStyle-Width="50" HeaderText="Mütalaa ID" HeaderStyle-ForeColor="#000000"></asp:BoundColumn>
<asp:BoundColumn DataField="MutaalaSecilenTarihi" HeaderStyle-Width="110" HeaderText="Mütalaa Tarihi"></asp:BoundColumn>
<asp:BoundColumn DataField="MutaalaBaslik" HeaderText="Mütalaa Başlık"></asp:BoundColumn>
<asp:HyperLinkColumn Text="Git >>" HeaderStyle-Width="40" DataNavigateUrlField="MutaalaID" DataNavigateUrlFormatString="MutaalaDetay.aspx?MutaalaID={0}"
HeaderText="Sonuçlar"></asp:HyperLinkColumn>
</Columns>
<PagerStyle HorizontalAlign="Right" ForeColor="Black" Position="TopAndBottom" BackColor="#CCCCCC"
Mode="NumericPages"></PagerStyle>
</asp:datagrid>
This datagrid is binding if the web page is not making postback.
This metot(FilitreYap()) is using for hidding search criterions like keyword or level of search bla bla. Why we are putting this variable to hidden field ?? Just why we can't use static variable.. I tried it but it is not a solution because this application is working internet. Variables always problem so if we are using web,we must know and must use web language its know HTML.
Practically i put the variables on hidden fields and then i gave these variables from this fields. When i am binding this datagrid how i gave this values from hidden fields.
And the last event is datagrid page index changed event. This event for binding for every changed pages of datagrid.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

canersahan
Web Developer
Turkey Turkey
He is working for e-commerce web site in Istanbul. He is interested in C# game-programming,asp.net,e-commerce skills about security.

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 26 Feb 2006
Article Copyright 2006 by canersahan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid