1、添加序号列
<asp:TemplateField HeaderText="序号">
<ItemTemplate>
<%#(Container.DataItemIndex+1).ToString() %>
</ItemTemplate>
</asp:TemplateField>
2、分页
/// <summary>
/// 初始化加载数据
/// </summary>
public void InitData()
{
this.grid_UserManage.DataSource = systemlogininfobll.GetAllSystemLogin();
this.grid_UserManage.DataBind();
}
protected void grid_UserManage_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.grid_UserManage.PageIndex = e.NewPageIndex;
InitData();
}
3、高亮显示
protected void grid_UserManage_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//高亮显示鼠标指定行数据
e.Row.Attributes.Add("onMouseOver", "Color=this.style.backgroundColor;this.style.backgroundColor='lightBlue'");
e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor=Color;");
}
}