简体   繁体   English

如何从asp.net中的模式对话框访问click事件代码背后的代码

[英]How to access the code behind click event code from a modal dialog box in asp.net

I have a modal dialog box which is a feedback form, on clicking the send button the code which has been written behind the page should execute. 我有一个模态对话框是一个反馈表单,单击发送按钮时,应该执行页面后面写的代码。 How to interconnect . 如何互连。

The issue here is the jQuery dialog funciton moves the dialog elements outside of the web pages server form. 这里的问题是jQuery对话框功能将对话框元素移动到网页服务器表单之外。 To get around this you will have to append the dialog back to the form. 要解决此问题,您必须将对话框附加回表单。

<script>
        $(document).ready(function () {
            var dlg = $('#popout').dialog();
            dlg.parent().appendTo($('form'));

        });
</script>

or 要么

<script>
        $(document).ready(function () {
            $('#popout').dialog({
               open: function(type, data) {
                         $(this).parent().appendTo($('form'));
               }
            });
        });
</script>

I think you're asking how to assign event handlers. 我想你在问如何分配事件处理程序。 Here's an example: 这是一个例子:

<asp:Button ID="Button1" runat="server" Text="Send" OnClick="Button1_Click" ... />

In the above example, the OnClick attribute tells the button which code-behind event to use when the button is clicked: 在上面的示例中, OnClick属性告诉按钮单击按钮时要使用的代码隐藏事件:

protected void Button1_Click(object sender, EventArgs e)
{
    //your click event logic here
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM