日期:2014-05-17 浏览次数:20446 次
<asp:GridView ID="ResGridView" runat="server"
DataSourceID="SqlDataSource1" AllowPaging="True" BackColor="White"
BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3"
GridLines="Horizontal" onpageindexchanged="ResGridView_PageIndexChanged">
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class test_page : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ResGridView.DataBind();
}
}
protected void QryButton_Click(object sender, EventArgs e)
{
string strTable = "";
/*set strTable...*/
SqlDataSource1.SelectCommand += "select cus_id from t_temp" + strTable;
ResGridView.Visible = true;
ResGridView.DataBind();
}
protected void ResGridView_PageIndexChanged(object sender, EventArgs e)
{
ResGridView.DataBind();
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
&