datagrid怎么设置分页?

80酷酷网    80kuku.com

  datagrid|分页<asp:DataGrid id="programmaticID" runat=server

     DataSource='<%# DataBindingExpression %>'

     AllowPaging="True|False"

     AllowSorting="True|False"

     AutoGenerateColumns="True|False"

     BackImageUrl="url"

     CellPadding="pixels"

     CellSpacing="pixels"

     DataKeyField="DataSourceKeyField"

     GridLines="None|Horizontal|Vertical|Both"

     HorizontalAlign="Center|Justify|Left|NotSet|Right"

     PagedDataSource

     PageSize="ItemCount"

     ShowFooter="True|False"

     ShowHeader="True|False"

     VirtualItemCount="ItemCount"

     OnCancelCommand="OnCancelCommandMethod"

     OnDeleteCommand="OnDeleteCommandMethod"

     OnEditCommand="OnEditCommandMethod"

     OnItemCommand="OnItemCommandMethod"

     OnItemCreated="OnItemCreatedMethod"

     OnPageIndexChanged="OnPageIndexChangedMethod"

     OnSortCommand="OnSortCommandMethod"

     OnUpdateCommand="OnUpdateCommandMethod">



   <AlternatingItemStyle property="value"/>

   <EditItemStyle property="value"/>

   <FooterStyle property="value"/>

   <HeaderStyle property="value"/>

   <ItemStyle property="value"/>

   <PagerStyle property="value"/>

   <SelectedItemStyle property="value"/>



</asp:DataGrid>

or

<asp:DataGrid id="programmaticID" runat=server

     DataSource='<%# DataBindingExpression %>'

     AutoGenerateColumns="False"

     (other properties)>



   <AlternatingItemStyle property="value"/>

   <EditItemStyle property="value"/>

   <FooterStyle property="value"/>

   <HeaderStyle property="value"/>

   <ItemStyle property="value"/>

   <PagerStyle property="value"/>

   <SelectedItemStyle property="value"/>



   <Columns>

      <asp:BoundColumn

           DataField="DataSourceField"

           DataFormatString="FormatString"

           FooterText="FooterText"

           HeaderImageUrl="url"

           HeaderText="HeaderText"

           ReadOnly="True|False"

           SortField="DataSourceFieldToSortBy"

           Visible="True|False"

           FooterStyle-property="value"

           HeaderStyle-property="value"

           ItemStyle-property="value"/>



      <asp:ButtonColumn

           ButtonType="LinkButton|PushButton"

           Command="BubbleText"

           DataTextField="DataSourceField"

           DataTextFormatString="FormatString"

           FooterText="FooterText"

           HeaderImageUrl="url"

           HeaderText="HeaderText"

           ReadOnly="True|False"

           SortField="DataSourceFieldToSortBy"

           Text="ButtonCaption"

           Visible="True|False"/>



      <asp:EditCommandColumn

           ButtonType="LinkButton|PushButton"

           CancelText="CancelButtonCaption"

           EditText="EditButtonCaption"

           FooterText="FooterText"

           HeaderImageUrl="url"

           HeaderText="HeaderText"

           ReadOnly="True|False"

           SortField="DataSourceFieldToSortBy"

           UpdateText="UpdateButtonCaption"

           Visible="True|False"/>



      <asp:HyperLinkColumn

           DataNavigateUrlField="DataSourceField"

           DataNavigateUrlFormatString="FormatExpression"

           DataTextField="DataSourceField"

           DataTextFormatString="FormatExpression"

           FooterText="FooterText"

           HeaderImageUrl="url"

           HeaderText="HeaderText"

           NavigateUrl="url"

           ReadOnly="True|False"

           SortField="DataSourceFieldToSortBy"

           Target="window"

           Text="HyperLinkText"

           Visible="True|False"/>



      <asp:TemplateColumn

           FooterText="FooterText"

           HeaderImageUrl="url"

           HeaderText="HeaderText"

           ReadOnly="True|False"

           SortField="DataSourceFieldToSortBy"

           Visible="True|False">



         <HeaderTemplate>

            Header template HTML

         </HeaderTemplate >

         <ItemTemplate>

            ItemTemplate HTML

         </ItemTemplate>

         <EditItemTemplate>

            EditItem template HTML

         </EditItemTemplate>

         <FooterTemplate>

            Footer template HTML

         </FooterTemplate>



      </asp:TemplateColumn>

   </Columns>



</asp:DataGrid>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: