弹出窗口在ASP.Net [英] Popup Window in ASP.Net

查看:82
本文介绍了弹出窗口在ASP.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IM到C#和ASP.Net很新。有谁知道如何在ASP中创建一个弹出?

im very new to C# and ASP.Net. Does anybody know how to create a popup in Asp?

我的情况:

当我点击一个按钮,它会检查一些状态。如果被满足的条件弹出须抛出由于状态(此处为:实现百分比)。

When I click on a button, it checks some states. If a condition is being fulfilled a popup shall be thrown due to the state (here: achieved percentages).

所以2 invidual弹出窗口应通过点击该按钮被抛出。

So 2 invidual Popup Windows shall be thrown by clicking the same button.

(是否要中止合同,这是没有完成?是 - 否)

(Do you want to abort the contract, which wasn't completed? Yes - No)

(你想完成的合同,这并没有达到目标?是 - 否)

(Do you want to completed the contract, which hasn't achieved the target? Yes - No)

所以对话框,按照为当条件被fullfilled相同的按钮出现。

So the dialog boxes shall appear according for the same button when the condition was fullfilled.

有人能帮助我吗? (在C#和JavaScript的背后code?)

Can anybody help me? (Code behind in C# and javascript?)

推荐答案

谢谢大家谁试图帮助。

我决定使用JavaScript。

I decided to use Javascript.

下面是ASPX-文件的code节选:

Here is a code excerpt of the aspx-File:

<pre lang="cs">&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;

        String.Format = function () {
            var s = arguments[0];
            for (var i = 0; i &lt; arguments.length - 1; i++) {
                var reg = new RegExp(&quot;\\{&quot; + i + &quot;\\}&quot;, &quot;gm&quot;);
                s = s.replace(reg, arguments[i + 1]);
            }
            return s;
        };
        var dialogConfirmed = false;

        function SetDialogConfirmedFalse() {
            dialogConfirmed = false;
        }

        function ConfirmDialog(obj, title, dialogText) {
            if (!dialogConfirmed) { //!$('#dialog').is(':data(dialog)')
                $('body').append(String.Format(&quot;&lt;div id='dialog' title='{0}'&gt;&lt;p&gt;{1}&lt;/p&gt;&lt;/div&gt;&quot;,
                    title, dialogText));

                $('#dialog').dialog({
                    height: 110,
                    modal: true,
                    resizable: false,
                    draggable: false,
                    close: function (event, ui) { $('body').find('#dialog').remove(); },
                    buttons:
                    {
                        'Ja': function () {
                            $('#dialog').dialog('close');
                            dialogConfirmed = true;
                            if (obj) obj.click();
                        },
                        'Nein': function () {
                            $('#dialog').dialog('close');
                        }
                    }
                });
                $(&quot;.ui-widget&quot;).css({ &quot;font-size&quot;: +18 + &quot;px&quot; });
            }
            return dialogConfirmed;
        }</pre>

在CS-文件诠释他的事件处理程序背后的code会抛出这个弹出:

Code behind the in CS-File int he Eventhandler which throws this popup:

<pre lang="cs">var script = &quot;ConfirmDialog(this, '&quot; + CommonRes.Attention +
                             "Wollen Sie wirklich beenden?");&quot;;
            ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), script, true);</pre>

我的下一个问题是:我怎样才能得到返回值什么是pssed JavaScript函数中的CS-文件使用它的$ P $?

My next question is: How can I get the return value what was being pressed of the javascript function to use it in the cs-File?

感谢你在期待!

这篇关于弹出窗口在ASP.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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