none
LINQ How To: How to Use LinqDataSource RRS feed

  • 一般討論

  • 1.       Add LinqDataSource control. In smart tag, select Configure Data Source.

    2.       In Configure Data Source Dialog Box, select [YourDataContext] and then select [YourTable] Table and click Finish button.

    3.       Set the DataSourceID of the ListView to the new LinqDataSource1.

    <asp:LinqDataSource ID="LinqDataSource1" runat="server"

            ContextTypeName="[YourDataContext]" TableName="[YourTable]">

    </asp:LinqDataSource>

     

    4.       Add DataPager control and wire to ListView by setting the PagedControlID property to ListView1.

    5.       Select the DataPager. In smart tag, select Edit Pager Fields. Add the Numeric Pager Field. For styling, set the CurrentPageLabelCssClass to ‘pagerlabel’, and the NumericButtonCssClass to ‘pagerlink’.

    <aspBig SmileataPager ID="DataPager1" runat="server" PagedControlID="ListView1">

            <Fields>

                <asp:numericpagerfield CurrentPageLabelCssClass="pagerlabel" NextPageText="..."

                    NumericButtonCssClass="pagerlink" PreviousPageText="..." />

            </Fields>

    </aspBig SmileataPager>

     

     

     

     

    2008年1月21日 下午 04:45