protected void GridView_..._RowDataBound(object sender, GridViewRowEventArgs e)
{
点击表格打开窗口
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chk = (CheckBox)e.Row.FindControl("CheckBox1");
string url = String.Format("parent.frm?.location='?.aspx?ID={0}';SetCheckBoxState('{1}');", e.Row.Cells[1].Text, chk.ClientID);
鼠标划过改变列表状态
e.Row.Attributes.Add("OnClick",url);
e.Row.Attributes.Add("onmouseover", "Ovr(this,'#C9E4FE');");
e.Row.Attributes.Add("onmouseout", "Out(this,'#FFFFFF');");
}
}
//初始化页码,页面数,及总记录数
public void ShowState(DataSet ds1)
{
lblcurrent.Text = " 第 " + (GridView.PageIndex + 1).ToString() + " 页";
lblcount.Text = " 总 " + GridView.PageCount + " 页";
lblRecord.Text = " 共 " + ds1.Tables[0].Rows.Count.ToString() + " 条记录";
}
//翻页按钮
public void PagerButtonClick(object sender, System.EventArgs e)
{
string arg = ((LinkButton)sender).CommandArgument;
if (arg.ToString() == "first")
{
GridView.PageIndex = 0;
}
if (arg.ToString() == "prev" && GridView.PageIndex > 0)
{
GridView.PageIndex -= 1;
}
if (arg.ToString() == "next" && GridView.PageIndex < GridView.PageCount - 1)
{
GridView.PageIndex += 1;
}
if (arg.ToString() == "last")
{
if (GridView.PageCount > 0)
{
GridView.PageIndex = GridView__.PageCount - 1;
}
}
BindCarList();
}