单击GridView中的超链接 - 弹出窗口在Chrome中无效 [英] Clicking on Hyperlink in the GridView - Popup is not working in Chrome
本文介绍了单击GridView中的超链接 - 弹出窗口在Chrome中无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
点击 GridView
-Popup中的超链接无法在Chrome中运行。
但是,工作得很好在IE浏览器。
请帮助。在此先感谢
代码:
Clicking on Hyperlink in the GridView
-Popup is not working in Chrome.
But, working nicely in IE .
Please help. Thanks in Advance
CODE:
<dx:GridViewDataColumn FieldName="Orderno" Caption="Order" UnboundType="String" CellStyle-CssClass="myStyle"
Width="10%" VisibleIndex="2" HeaderStyle-HorizontalAlign="Center">
<DataItemTemplate>
<dx:ASPxHyperLink ID="hyperLink" runat="server" OnInit="hyperLink_Init">
</dx:ASPxHyperLink>
</DataItemTemplate>
</dx:GridViewDataColumn>
c#
c#
protected void hyperLink_Init(object sender, EventArgs e) //added by kav 30thJuly'2014
{
try
{
ASPxHyperLink link = (ASPxHyperLink)sender;
GridViewDataItemTemplateContainer templateContainer = (GridViewDataItemTemplateContainer)link.NamingContainer;
int rowVisibleIndex = templateContainer.VisibleIndex;
string ean13 = templateContainer.Grid.GetRowValues(rowVisibleIndex, "INVOICE_AUTO_ID").ToString();
string Order = templateContainer.Grid.GetRowValues(rowVisibleIndex, "Orderno").ToString();
link.NavigateUrl = "javascript:void(0);";
link.Text = Order;
if (Order.ToLower() == "Bonus".ToLower())
{
Order = Order + ","+ ean13;
}
link.ClientSideEvents.Click = string.Format("function(s, e) {{ OnMoreInfoClick('{0}'); }}", Order);
}
catch (Exception ee)
{
}
}
JavaScript
JavaScript
function OnMoreInfoClick(contentUrl) {
debugger;
var w_r_v = window.showModalDialog('Commissions/Invoice_Calculation_list.aspx?Invoice_auto_id=' + contentUrl, null, 'status:no;dialogWidth:800px;dialogHeight:420px;dialogHide:true;help:no;scroll:auto;maximize:yes');
}
__Kav
添加预
标签。
格式化更改。
[/编辑]
推荐答案
使用我以前的答案 [ ^ ]到一个不同但相似的问题:
从Chrome 37开始,window.showModalDialog功能已被禁用:
http://blog.chromium.org/2014/07/disabling-showmodaldialog.html [ ^ ]
您可以更改客户端上的设置,以便在2015年5月之前暂时重新启用它:
http://codecorner.galanter.net/2014/09/02/reenable-showmodaldialog-in-chrome/ [< a href =http://codecorner.galanter.net/2014/09/02/reenable-showmodaldialog-in-chrome/target =_ blanktitle =New Window> ^ ]
但是,您应该考虑用替代方案替换此呼叫。例如:
https://github.com/GoogleChrome/dialog-polyfill [< a href =https://github.com/GoogleChrome/dialog-polyfilltarget =_ blanktitle =New Window> ^ ]
http://jqueryui.com/dialog/ [ ^ ]
http://getbootstrap.com/javascript/#modals [ ^ ]
Expanding on Solution #4 with links from my previous answer[^] to a different but similar question:
The window.showModalDialog function has been disabled as of Chrome 37:
http://blog.chromium.org/2014/07/disabling-showmodaldialog.html[^]
You might be able to change a setting on the client to temporarily re-enable it until May 2015:
http://codecorner.galanter.net/2014/09/02/reenable-showmodaldialog-in-chrome/[^]
However, you should be looking to replace this call with an alternative. For example:
https://github.com/GoogleChrome/dialog-polyfill[^]
http://jqueryui.com/dialog/[^]
http://getbootstrap.com/javascript/#modals[^]
一旦你尝试这样,我不确定它是否在我的项目中工作
once you try like this am not sure it is working in my project
aName.Attributes["onclick"] = "javascript:OnMoreInfoClick(" + OnMoreInfoClick + ");";
(or)
public void ScriptFunction(string function)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "jscript", function, true);
}
ScriptFunction("window.setTimeout('OnMoreInfoClick ("+ Order +")', 100)");
window.showModalDialog已从Chrome 37开始弃用。
window.showModalDialog has been deprecate starting with Chrome 37.
这篇关于单击GridView中的超链接 - 弹出窗口在Chrome中无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文