我有一个gridview,其rowdatabound设置如下:
protected void gvStatusActivities_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvStatusActivities, "Select$" + e.Row.RowIndex);
e.Row.ToolTip = "Click to select this row.";
e.Row.Style.Add("cursor", "pointer");
//other code...
}
}
我试图调用javascript(从gridview中选择索引更改事件)将行数据复制到剪贴板,如下所示:
string strScript="<script type='text/javascript'>CopyDataToClipboard('copy text');</script>";
ClientScript.RegisterStartupScript(typeof(string), "Msg", strScript);
然而,当我选择gridview行时,没有调用javascript函数。有什么帮助吗?