日期:2014-05-17 浏览次数:20432 次
public partial class freightList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["searchSql"] = null;
}
bindFreight();
}
protected void bindFreight()
{
string sql = "select * from cargo";
gvFreight.DataSource = dataOperate.getDataset(sql, "cargo"); //调用getDataset方法将返回值绑定到GridView上
gvFreight.DataBind();
}
protected void gvFreight_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
string sql;
sql = Convert.ToString(Session["searchSql"]);
if (Session["searchSql"] == null)
{
gvFreight.PageIndex = e.NewPageIndex;
gvFreight.DataBind();
}
else
{
gvFreight.DataSource = dataOperate.getDataset(sql, "cargo"); //调用getDataset方法将返回值绑定到GridView上
gvFreight.PageIndex = e.NewPageIndex;
gvFreight.DataBind();
&n