Javascript 在gridview中高亮显示选定行而不回发
我在asp.net中有一个gridview,每当单击它时,它都会更新预览图片。这在没有回发的情况下有效,我是这样做的:Javascript 在gridview中高亮显示选定行而不回发,javascript,asp.net,gridview,Javascript,Asp.net,Gridview,我在asp.net中有一个gridview,每当单击它时,它都会更新预览图片。这在没有回发的情况下有效,我是这样做的: protected void GridView1_RowCreated(object sender,System.Web.UI.WebControls.GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["on
protected void GridView1_RowCreated(object sender,System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
e.Row.ToolTip = "Click to select row";
e.Row.Attributes["onclick"] = "RetrievePicture(" + GVmail.DataKeys[e.Row.RowIndex].Value.ToString() + ",this)";
}
}
但是,我希望用户能够看到选择了哪一行,从而显示图像。。(因此,我希望行保持高亮显示)。然后,当选择另一行时,我希望该行恢复正常,并高亮显示新选择的一行
如果没有回发,我怎么做呢?看到了吗
for (int i = 0; i < gridview.Rows.Count; i++)
{
GridViewRow row;
row = gridview.Rows[i];
if (row.Cells[1].Text.Equals("ABSENT"))
{
row.BackColor = System.Drawing.Color.IndianRed;
row.ForeColor = System.Drawing.Color.White;
row.Font.Bold = true;
}
}
for(int i=0;i
但愿能帮助你 这可能会帮助你,谢谢,你的链接是我所需要的我需要它不做在客户端。。。这不符合我的需要,onClientClick属性可能