如何在GridView中打开一个链接的弹出窗口

用户名

我试图在Java脚本中为网格视图构建一个弹出窗口功能,但无法打开该窗口。

var oldgridcolor;
function SetMouseOver(element) {
    oldgridcolor = element.style.backgroundColor;
    element.style.backgroundColor = '#ffeb95';
    element.style.cursor = 'pointer';
    element.style.textDecoration = 'underline';
}
function SetMouseOut(element) {
    element.style.backgroundColor = oldgridcolor;
    element.style.textDecoration = 'none';

}
function SetMouseDown(element) {
    var r = confirm('Are you sure?');
    var url = window.location.pathname;
    var pathArray = url.split('/');
    var host = pathArray[1];
    var newHost = '/About.aspx';

    if (r == true) {
        window.location = host + newHost;
    }
    else {
        alert('it didnt work');
    }
    return false;
}

背后的代码

 protected void gvrecords_RowDataBound(object sender, GridViewRowEventArgs e)
  {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        e.Row.Attributes["onmouseover"] = "javascript:SetMouseOver(this)";
        e.Row.Attributes["onmouseout"] = "javascript:SetMouseOut(this)";
        e.Row.Attributes["onmousedown"] = "javascript:SetMouseDown(this)";
    }

任何帮助将不胜感激。

曼诺·梅瓦达(Manoj mevada)

请尝试一下,它可能会对您有所帮助。

function SetMouseDown(element) {
    var r = confirm('Are you sure?');
    var url = window.location.pathname;
    var pathArray = url.split('/');
    var host = pathArray[1];
    var newHost = '/About.aspx';

    if (r == true) {
        //window.location = host + newHost;

        window.open(host + newHost,'name','width=200,height=200');
    }
    else {
        alert('it didnt work');
    }
    return false;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何仅打开一个窗口弹出窗口

在 MVC 中的操作链接上打开一个弹出窗口

如何只打开一个弹出窗口

传单地图:打开一个窗口时,如何阻止所有弹出窗口关闭?

如何在当前窗口中打开一个多条记录,而不是在odoo V13中弹出

如何在Android中@键按下打开一个对话窗口?

如何在c#winform中仅打开一个窗口

如何在控制台应用程序中打开一个窗口?

PyQt5:如何在每个连接的屏幕中打开一个窗口?

如何一次只打开一个弹出窗口?

如何一次打开一个弹出窗口并在外部单击angular2中关闭弹出窗口

如何用Router Angular2打开一个弹出窗口?

如何打开一个包含用JavaScript编写的图形的弹出窗口?

在reactjs应用程序中打开一个弹出窗口

提交表单后在 mvc asp.net 中打开一个弹出窗口

jQuery:在弹出式jQuery中打开一个HTML窗口

用链接打开一个子窗口?

在浏览器中从winforms gridview列中打开一个链接

单击任何超链接或任何内容,Chrome打开一个新链接,并带有一个弹出窗口?

使用Material-UI从一个数组中的多个悬停弹出窗口仅打开一个弹出窗口

如何在两个窗口中打开一个PowerPoint文件?

如何在Java中使用Selenium在菜单中的新选项卡中打开一个链接

如何首先打开一个窗口,而不是在WPF(C#)中打开MainWindow

如果我的登录名和密码正确,如何在Tkinter中打开一个新窗口?

如何在 Dart (html) 中打开一个包含内容的新浏览器窗口

JavaFX-如何在同一窗口中打开一个新阶段?

如何防止情节提要打开一个窗口

在模式中的div中打开一个链接

signInWithPopup无法打开弹出窗口。而是打开一个新标签