日期:2014-05-17 浏览次数:20509 次
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AllowPaging="True" OnRowCreated="GridView1_RowCreated" CellPadding="4" ForeColor="#333333" CssClass="mytable" GridLines="None" PageSize="10" OnPageIndexChanging="GridView1_PageIndexChanging" > <Columns> <asp:TemplateField HeaderText="序号"> <ItemTemplate> <asp:CheckBox ID="CheckBox2" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="店铺名称" SortExpression="ShopName"> <ItemStyle Wrap="False" Width="150px" /> <ItemTemplate> <asp:Label ID="Label1" Width="150px" runat="server" Text='<%# Bind("ShopName") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </Columns> <PagerTemplate> 当前第: <asp:Label ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label> 页/共: <asp:Label ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label> 页 <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" Visible='<%#((GridView)Container.NamingContainer).PageIndex != 0 %>'>首页</asp:LinkButton> <asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>'>上一页</asp:LinkButton> <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>下一页</asp:LinkButton> <asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page" Visible='<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>'>尾页</asp:LinkButton> </PagerTemplate> </asp:GridView>
if (!IsPostBack) { dbcom_srcView = db.GetSqlStringCommand("select taoCouponsID,taoCouponsShopName,taoCouponsShopContent from TS_TAOCOUPONS"); db.ExecuteNonQuery(dbcom_srcView); if (db.ExecuteDataSet(dbcom_srcView).Tables[0].Rows.Count > 0) { GridView1.DataSource = db.ExecuteDataSet(dbcom_srcView).Tables[0]; GridView1.Da