Recent Articles

 
1: Read And Write XML with Dataset
Category: VB.NET
Added: 2/11/2009

 
2: Split Ajax Tab Control into Rows
Category: AJAX
Added: 2/2/2009

 
3: Path Less Css in Master Page in Asp.Net
Category: ASP.Net
Added: 1/27/2009

 
4: Prevent user going back to restricted area
Category: ASP.Net
Added: 1/25/2009

 
5: Sql Server MSC Error
Category: Databases
Added: 1/10/2009

 
6: Web Browser Control Javascript Close Button Error
Category: VB.NET
Added: 1/3/2009

 
7: ChartFX Volume in Candlestick without Extensions
Category: VB.NET
Added: 1/3/2009

 
8: Hard disk serial number Library
Category: VB.NET
Added: 1/3/2009

 
9: Roles And Membership
Category: ASP.Net
Added: 6/2/2008

 
10: ListView and DataPager in ASP.NET 3.5
Category: ASP.Net
Added: 5/15/2008

ListView and DataPager in ASP.NET 3.5

by Imran 15/May/2008

ListView and DataPager in ASP.NET 3.5


The ListView is a sort of hybrid between a DataGrid and Repeater that combines the free form templating of the Repeater with the editing features of the data grid. It looks interesting because it basically allows you much more control over the layout than a DataGrid does while still giving you many of the more advanced features of the data grid. The ListView doesn't support paging natively, so the DataPager serves as an external control to provide paging features. The advantage of a separate control is that it gives you much more control about what the pager looks like and where it can be placed on the page - anywhere basically. The Pager is essentially an extender control that extends the ListView with paging capabilities.

 <asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="Placeholder1" DataSourceID="LinqDataSource1"
            InsertItemPosition="FirstItem">
            <LayoutTemplate>
                <table runat="server" id="table1">
                    <tr runat="server" id="Placeholder1">
                    </tr>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("ID")%>
                    </td>
                </tr>
            </ItemTemplate>
            <InsertItemTemplate>
                <asp:LinkButton runat="server" ID="Link1" Text="Edit"></asp:LinkButton>
            </InsertItemTemplate>
        </asp:ListView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext"
            TableName="Table_1s">
        </asp:LinqDataSource>
        <asp:DataPager runat="server" ID="DataPager1" PageSize="2" PagedControlID="ListView1">
            <Fields>
                <asp:NumericPagerField />
            </Fields>
        </asp:DataPager>



Powered by DotNetClassic.com