//获取GridView的主键列的值
int ID = (int)GridView2.SelectedDataKey.Value;
//获取模板列中的控件值
DataTable dt = CardDAL.GetAllCard();
this.gv_data.DataSource = dt;
gv_data.DataBind();
for (int i = 0; i <gv_data.Rows.Count; i++)
{
Label lbl_locked = (Label)this.gv_data.Rows[i].FindControl("lbl_locked");
if (gv_data.Rows[i].Cells[6].Text=="True")
{
lbl_locked.Text = "是";
}
else
{
lbl_locked.Text = "否";
}
}
///鼠标移上离开时
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)
{
((LinkButton)e.Row.Cells[2].Controls[0]).Attributes.Add("onclick", "javascript:return confirm('你确认要删除:/"" + e.Row.Cells[1].Text + "/"吗?')");
e.Row.Attributes.Add("onmouseover", "OldStyle=this.style.backgroundColor;this.style.backgroundColor='#f4f1cc';");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=OldStyle;");
}
}
GridView鼠标移上离开的样式
最新推荐文章于 2025-09-05 11:22:47 发布
