protected void Button2_Click(object sender, EventArgs e)
{
ViewState["doSearch"] = "true";
string TB1 = TextBox1.Text.Trim();
Bang(TB1);
}
这个是查询按钮事件~
---------------------
下页是BANG事件
private void Bang(string TB1)
{
string Sql;
if (ViewState["dosearch"] != null)
{
Sql = "select * from newspage where Title like '%" + TB1 + "%'order by ID desc";
}
else
{
Rcount();
Sql = "select * from newspage order by ID desc";
}
GridView1.DataSource = mySm.GetTableBySql(Sql, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "k");
GridView1.DataBind();
Label1.Text = "总<font color=\"blue\"><b>" + AspNetPager1.RecordCount.ToString() + "</b></font>记录";
Label2.Text = " 总<font color=\"blue\"><b>" + AspNetPager1.PageCount.ToString() + "</b></font>页数";
Label3.Text = " 当前<font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + "</b></font>页";
ViewState["dosearch"] = null;
}
为何单击查询没有任何反应呢?
{
ViewState["doSearch"] = "true";
string TB1 = TextBox1.Text.Trim();
Bang(TB1);
}
这个是查询按钮事件~
---------------------
下页是BANG事件
private void Bang(string TB1)
{
string Sql;
if (ViewState["dosearch"] != null)
{
Sql = "select * from newspage where Title like '%" + TB1 + "%'order by ID desc";
}
else
{
Rcount();
Sql = "select * from newspage order by ID desc";
}
GridView1.DataSource = mySm.GetTableBySql(Sql, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "k");
GridView1.DataBind();
Label1.Text = "总<font color=\"blue\"><b>" + AspNetPager1.RecordCount.ToString() + "</b></font>记录";
Label2.Text = " 总<font color=\"blue\"><b>" + AspNetPager1.PageCount.ToString() + "</b></font>页数";
Label3.Text = " 当前<font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + "</b></font>页";
ViewState["dosearch"] = null;
}
为何单击查询没有任何反应呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货