我在更新面板中使用下面的代码来选择一行,这反过来更新另一个更新面板的表单记录中的细节。在更新面板中突出显示gridview行而不回发
protected void gvMainGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//Make the entire row clickable to select this record
//Uses javascript to post page back
e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';";
e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(this.gvMainGrid, "Select$" + e.Row.RowIndex));
}
}
我手动从数据库绑定的GridView和不想重新绑定网只是为了突出显示该行,但我似乎无法任意JavaScript添加到onclick事件,似乎无论是显示GetPostBackClientHyperlink或行突出显示javascript。
我应该提到我有代码来做突出显示,它将这个和选择一起添加,这是问题。 此代码是对我的+1的改进,谢谢。 – 2010-08-07 15:05:21