【发布时间】:2015-04-26 20:30:26
【问题描述】:
我在网格视图中有一个超链接。当我点击超链接时,我想打开一个新窗口。我可以打开一个新窗口。但模态弹出窗口也随之打开。当我单击超链接时,不应打开弹出窗口。当我点击行时它应该是打开的。不是超链接,它是网格视图行的一部分。
protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) {
SearchResult data = e.Row.DataItem as SearchResult;
// Add click to open modal
e.Row.Attributes.Add("onclick", string.Format("showDetail('{0}','{1}','{2}','{3}');", data.Number, data.System, customerNumber, customer.CustomerNumber));
// Choose background color
DefineBackgroundColor(e, data);
AddAccLink(e, data);
AddJumpTomain(e, data);
}
}
private void AddJumpTomain(GridViewRowEventArgs e, SearchResult 数据) { //强制跳转到 HyperLink jumpToPol= e.Row.FindControl("JumpTopol") as HyperLink;
if (jumpToPolicy != null)
{
string link = string.Format(Configuration.PolUrl, IdentityProvider.CurrentUser.GetUserName(), customerNumber, data.PolNumber);
jumpToPol.NavigateUrl = link;
//jumpToPol.Attributes.Add("onclick", "javascript:cancelEventPropagation(event);return true;");
jumpToPol.Attributes.Add("onclick", "javascript:window.open(" + link + ");return false;");
}
else
{
jumpToPol.Visible = false;
}
}
}
【问题讨论】:
标签: c# asp.net asp.net-mvc-4 c#-4.0