window.showModalDialog在后面的代码上执行 [英] window.showModalDialog execute on code behind

查看:53
本文介绍了window.showModalDialog在后面的代码上执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,程序员们,我现在对我的编码有些困惑,所以我正在寻求您的帮助.我要完成的工作是从服务器端的主页执行我的JavaScript.这是我在显示模式对话框(母版页)上有关javascript的代码

Hello fellow programmers, Im a little confused right now on my coding so I am seeking your help. What I am trying to accomplish to execute my javascript from my master page on server side. Here is my code on javascript on show modal dialog (master page)

function OpenPopup() {
            if (window.showModalDialog) {
                window.showModalDialog("PopUp.aspx", "PopUp",
"dialogWidth:550px;dialogHeight:300px,window.location = window.location;");
                window.location.reload();
            } else {
                window.open('PopUp.aspx', 'name', 'height=350,width=600,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');

            }
        }
    </script>


现在,我尝试在下面的代码上执行我的javascript,这是我的试用代码,但到目前为止没有任何效果.请帮忙


Now I am trying to execute my javascript on code behind here is my trial code but so far nothing is working. Please help

If e.CommandName = "cmdAdd" Then
           Dim addimage As ImageButton = DirectCast(e.CommandSource.FindControl("ImageAdd"), ImageButton)
           Dim coursecatId As String = addimage.CommandArgument
           Session("AddChecking") = "1"
           Session("AddCourseCatID") = coursecatId
           Session("AddYear") = drpdwnYear.Text
           Session("AddDiscipline") = DropDownList1.SelectedValue
           'addimage.Attributes.Add("onclick", "javascript:return OpenPopup()")

           'If (Not ClientScript.IsStartupScriptRegistered("OpenPopup")) Then
           'Page.ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "OpenPopup();", True)
           'End If
           'Master.Page.ClientScript.RegisterStartupScript(Me.[GetType](), "OpenPopup", "window.showModalDialog('PopUp.aspx','','');", True)
           'dialogWidth:550px;dialogHeight:300px,window.location = window.location;
           'Dim script = "var $dialog = $('<div></div>').html('This dialog will show every time!').dialog({autoOpen: false,title: 'Basic Dialog'});$dialog.dialog('open');"
           'Master.Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenPopup();", script, True)
           'Dim script = ("OpenPopup();")
           'Master.Page.ClientScript.RegisterStartupScript([GetType](), Guid.NewGuid().ToString(), script, True)


       Else




请注意, addimage.attribute.add(...)可以正常工作,但是我必须双击将使用户感到沮丧.我不能在rowdatabound上使用它,因为我需要会话,所以我真正需要的是RegisterStartupScript.

感谢和更多的力量




note that addimage.attribute.add(...) is working but I have to double click which will kinda frustrate the user. I cannot use it on rowdatabound cause I need the sessions so what I really need is RegisterStartupScript.

thanks and more power

推荐答案

对话框=


('< div></div>').html( 此对话​​框每次都会显示!").dialog({autoOpen:false,title:'基本对话框'});
('<div></div>').html('This dialog will show every time!').dialog({autoOpen: false,title: 'Basic Dialog'});


dialog.dialog('open');" ' Master.Page.ClientScript.RegisterStartupScript(Me.GetType(),"OpenPopup();",脚本,True) ' Dim脚本=("OpenPopup();") ' Master.Page.ClientScript.RegisterStartupScript([GetType](),Guid.NewGuid().ToString(),脚本,是) 其他
dialog.dialog('open');" 'Master.Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenPopup();", script, True) 'Dim script = ("OpenPopup();") 'Master.Page.ClientScript.RegisterStartupScript([GetType](), Guid.NewGuid().ToString(), script, True) Else




请注意, addimage.attribute.add(...)可以正常工作,但是我必须双击将使用户感到沮丧.我不能在rowdatabound上使用它,因为我需要会话,所以我真正需要的是RegisterStartupScript.

谢谢,还有更多力量




note that addimage.attribute.add(...) is working but I have to double click which will kinda frustrate the user. I cannot use it on rowdatabound cause I need the sessions so what I really need is RegisterStartupScript.

thanks and more power


这篇关于window.showModalDialog在后面的代码上执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆