Answered by:
I want Header of my table to scroll when horizontal scroll is applied. The header should also scroll.

Question
-
User631918148 posted
Questions :
1) What should i go for ASP.Net Repeater or a ASP.Net GridView ?
2) I will have Pagination so what is better option to fulfill my requirements ?
Also send me links where i can get a demo of thead scroll .
Monday, May 9, 2016 5:58 AM
Answers
-
User364480375 posted
according to your requirement u should use gridview.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 9, 2016 6:47 AM -
User-271186128 posted
Hi abrar.kazi,
I want Header of my table to scroll when horizontal scroll is applied. The header should also scroll.
When the horizontal scroll is applied? If you want to scroll the table, you can add a div outside the GridView or repeater, and set the width and high property.
You can change the CSS overflow Property: http://www.w3schools.com/cssref/pr_pos_overflow.asp
1) What should i go for ASP.Net Repeater or a ASP.Net GridView ?Both are fine, you can use either of them to bind data.
If you are using repeater control, you can refer to the following code:
<asp:Repeater ID="rptCustomers" runat="server"> <HeaderTemplate> <table cellspacing="0" rules="all" border="1"> <tr> <th scope="col" style="width: 80px"> Customer Id </th> <th scope="col" style="width: 120px"> Customer Name </th> <th scope="col" style="width: 100px"> Country </th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:Label ID="lblCustomerId" runat="server" Text='<%# Eval("CustomerId") %>' /> </td> <td> <asp:Label ID="lblContactName" runat="server" Text='<%# Eval("ContactName") %>' /> </td> <td> <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("Country") %>' /> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>
More details, see: http://www.aspsnippets.com/Articles/Repeater-control-Tutorial-with-example-in-ASPNet-using-C-and-VBNet.aspx
2) I will have Pagination so what is better option to fulfill my requirements ?Here is an article about Custom Paging with PageSize Change Dropdown, you can refer to it:
http://www.aspsnippets.com/Articles/ASPNet-GridView-Custom-Paging-with-PageSize-Change-Dropdown.aspx
Best regards,
Dillion- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 9, 2016 9:02 AM -
All replies
-
User364480375 posted
according to your requirement u should use gridview.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 9, 2016 6:47 AM -
User-271186128 posted
Hi abrar.kazi,
I want Header of my table to scroll when horizontal scroll is applied. The header should also scroll.
When the horizontal scroll is applied? If you want to scroll the table, you can add a div outside the GridView or repeater, and set the width and high property.
You can change the CSS overflow Property: http://www.w3schools.com/cssref/pr_pos_overflow.asp
1) What should i go for ASP.Net Repeater or a ASP.Net GridView ?Both are fine, you can use either of them to bind data.
If you are using repeater control, you can refer to the following code:
<asp:Repeater ID="rptCustomers" runat="server"> <HeaderTemplate> <table cellspacing="0" rules="all" border="1"> <tr> <th scope="col" style="width: 80px"> Customer Id </th> <th scope="col" style="width: 120px"> Customer Name </th> <th scope="col" style="width: 100px"> Country </th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:Label ID="lblCustomerId" runat="server" Text='<%# Eval("CustomerId") %>' /> </td> <td> <asp:Label ID="lblContactName" runat="server" Text='<%# Eval("ContactName") %>' /> </td> <td> <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("Country") %>' /> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>
More details, see: http://www.aspsnippets.com/Articles/Repeater-control-Tutorial-with-example-in-ASPNet-using-C-and-VBNet.aspx
2) I will have Pagination so what is better option to fulfill my requirements ?Here is an article about Custom Paging with PageSize Change Dropdown, you can refer to it:
http://www.aspsnippets.com/Articles/ASPNet-GridView-Custom-Paging-with-PageSize-Change-Dropdown.aspx
Best regards,
Dillion- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, May 9, 2016 9:02 AM -
User631918148 posted
Thanks :)
Monday, May 9, 2016 10:14 AM -