【发布时间】:2010-08-07 07:33:29
【问题描述】:
我在更新面板中有一个网格视图,其中包含以下代码来选择一行,这反过来又使用表单记录中的详细信息更新另一个更新面板。
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,不想重新绑定网格只是为了突出显示该行,但我似乎无法向 onclick 事件添加任何 javascript,它似乎要么显示 GetPostBackClientHyperlink 要么该行突出显示 javascript。
【问题讨论】: