我在 asp.net 中有一个 gridview,只要单击它就会更新预览图片。这无需回发即可工作,我这样做:
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)";
}
}
但是,我希望用户能够看到选择了哪一行并因此显示图像..(所以我希望行保持突出显示)。and then when another row is selected, i want that row to go back to normal and the newly selected one to be highlighted.
如果没有回发,我怎么能做到这一点?