在一个Ajax工具包模式弹出扩展做回发 [英] Doing post back on an ajax toolkit modal popup extender

查看:119
本文介绍了在一个Ajax工具包模式弹出扩展做回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Ajax工具包模式弹出扩展弹出一个表单从用户收集信息。我打算送从用户到code收集的数据背后保存到数据库中该表单的提交按钮的点击。我发现,然而,提交按钮不回发到金丹都没有。

I use an Ajax Toolkit modal pop-up extender to pop-up a form for collecting information from the user. I intend to send the data collected from the user to the code behind for saving into the database on click of the submit button on that form. I found out, however, that the submit button is not posting back to the saver at all.

我不想使用任何客户端编码或Web服务

I do not want to use any client side coding or a web service.

它是在任何可能的方式做回发一个模式弹出?

Is it in any way possible to do post back on a modal pop?

推荐答案

有你的问题的两种解决方案:

There are two solutions of your problem:


  1. 创建与ASP的形式:在一个div按钮,初步确定这是显示无。在弹出的时间只是使它可见你可以将它作为您的要求的位置。然后点击提交按钮后,将正常和重定向页面。

  1. Create form with asp:button in a div, initially set it's display none. At the time of popup just make it visible you can set it's position as your requirement. Then after click on submit button it will behave normally and redirect your page.

这是使用jQuery和Ajax。创建HTML表单并提交调用JavaScript函数
 JavaScript函数: -

It is by using jQuery and Ajax. Create a html form and on submit call a JavaScript function JavaScript function :-

 function on_submit(){
    var pageUrl = 'your_page_name.aspx'
     $.ajax({
       type: "POST",
       url: pageUrl + "/your_web_method",
       data: '{data1:value1, data2:value2}',
       contentType: "application/json; charset=utf-8",
       dataType: "json",
       success: function(msg) {
                make your success code here
          }
    });

  in C# 
    [WebMethod]
    public static void your_web_method(data1, data2)
    {
        // your code to store value in database
    }


这篇关于在一个Ajax工具包模式弹出扩展做回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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