<asp:DataGrid ID="DG1" runat="server" Font-Size="Small" Font-Names="宋体" CellPadding="2"
BorderWidth="1px" BackColor="#B7C4CD" BorderColor="#CCCCFF" Width="624px" AutoGenerateColumns="False"
PagerStyle-HorizontalAlign="Right" onitemcommand="DG1_ItemCommand" >
<SelectedItemStyle ForeColor="GhostWhite" BackColor="DarkSlateBlue"></SelectedItemStyle>
<PagerStyle Mode="NumericPages" Visible="False" />
<AlternatingItemStyle 间隔颜色BackColor="#E9F4FB"></AlternatingItemStyle>
<ItemStyle BackColor="White"></ItemStyle> 间隔颜色
<HeaderStyle Font-Bold="True" ForeColor="#333399" BackColor="#EBEFF1" Font-Italic="False"
Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center">
</HeaderStyle>
<Columns>
<asp:TemplateColumn>
<HeaderStyle HorizontalAlign="Center" Width="13px"></HeaderStyle>
<ItemStyle Width="20px" HorizontalAlign="Center" />
<HeaderTemplate>
<asp:CheckBox ID="Cbx_CheckAll" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="Cbx_Delete" runat="server"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="GetRemark" FooterStyle-Width="25px" HeaderText="文件描述">
<FooterStyle Width="25px"></FooterStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="GetDocument_Nm" HeaderText="文件名"></asp:BoundColumn>
<asp:TemplateColumn>
<HeaderTemplate>
操作
</HeaderTemplate>
<ItemTemplate>
<asp:ImageButton ID="ibnShow" runat="server" BorderWidth="0px" ImageUrl="Images/show.jpg"
CommandName="Show" />
<asp:ImageButton ID="ibnEdit" runat="server" BorderWidth="0px" ImageUrl="Images/edit.jpg"
CommandName="Edit" />
<asp:ImageButton ID="ibnDelete" runat="server" BorderWidth="0px" ImageUrl="Images/delete.jpg"
CommandName="Delete" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
sql 语句分页:
末页:
select * from (SELECT [REMARK],[DOCUMENT_NM],[TYPE],[VERSION_NO],[CREATE_ID],[CREATE_DT],ROW_NUMBER() over (order by [DOCUMENT_NM]) as RowNumber FROM [BM2].[dbo].[DOCUMENT_TBL] WHERE [CMP_ID]='" + CMP_ID + "' AND [PATH]='" + Path + "') as A Where RowNumber > + (CurrentPage - 1) * PageSize
不是末页(条件改变):
as A Where RowNumber between ((CurrentPage - 1) * PageSize + 1) AND CurrentPage * PageSize
DataGrid设置选中列值:
Lbl_Page.Text = e.Item.Cells[1].Text;
if (((CheckBox)e.Item.FindControl("Checkbox 的id")).Checked)