C# 当我点击对话框jquery的按钮时,执行代码隐藏函数

C# 当我点击对话框jquery的按钮时,执行代码隐藏函数,c#,asp.net,jquery-dialog,C#,Asp.net,Jquery Dialog,我有一个按钮,打开一个dilag Jquery并显示一些div。对话框显示两个按钮(“ok”和“Cancel”) 我想在单击对话框“确定”时执行代码隐藏函数(C#.net) 我该怎么做 $("#dialog").dialog({ autoOpen: false, modal: true, title: "Image Full Size", draggable: true, resizable: false, show: 100, width

我有一个按钮,打开一个dilag Jquery并显示一些div。对话框显示两个按钮(“ok”和“Cancel”)

我想在单击对话框“确定”时执行代码隐藏函数(C#.net)

我该怎么做

$("#dialog").dialog({
    autoOpen: false,
    modal: true,
    title: "Image Full Size",
    draggable: true,
    resizable: false,
    show: 100,
    width: 900,
    height: 680,
    buttons:
        {
            "Ok": function () {
                $(this).dialog("close");
            },
            "Cancel": function () {
                $(this).dialog("close");
            }
        }
    });
例如:

在C#.net中调用下面的下一个函数


获取此功能的一种非常快速和简单的方法是在OnValueChange事件中使用隐藏字段

<asp:HiddenField ID="hf" clientidmode="static" runat="server" OnValueChanged="hf_ValueChanged" />

获取此功能的一种非常快速和简单的方法是在OnValueChange事件中使用隐藏字段

<asp:HiddenField ID="hf" clientidmode="static" runat="server" OnValueChanged="hf_ValueChanged" />
请参阅下面的代码

  $("#dialog").dialog({
       autoOpen: false,
       modal: true,
       title: "Image Full Size",
       draggable: true,
       resizable: false,
       show: 100,
       width: 900,
       height: 680,
       buttons:
      {
           "Ok": function () {
             $.ajax({ type: "GET",
             contenttype: "application/json; charset=utf-8",
            data: "{null}",
           url: "WebService1.asmx/loadInfo",
           dataType:"json",
            success: function(res) {
           // Do something means binding data
     },
     error: function(err) {
     alert(err);
 }
   });   
         $(this).dialog("close");
        },
        "Cancel": function () {
            $(this).dialog("close");
        }
      }
 });
请参阅下面的代码

  $("#dialog").dialog({
       autoOpen: false,
       modal: true,
       title: "Image Full Size",
       draggable: true,
       resizable: false,
       show: 100,
       width: 900,
       height: 680,
       buttons:
      {
           "Ok": function () {
             $.ajax({ type: "GET",
             contenttype: "application/json; charset=utf-8",
            data: "{null}",
           url: "WebService1.asmx/loadInfo",
           dataType:"json",
            success: function(res) {
           // Do something means binding data
     },
     error: function(err) {
     alert(err);
 }
   });   
         $(this).dialog("close");
        },
        "Cancel": function () {
            $(this).dialog("close");
        }
      }
 });

这个问题有点开放,但您应该研究jQuery AJAX和/或
WebMethod
属性:这个问题有点开放,但您应该研究jQuery AJAX和/或
WebMethod
属性:
  $("#dialog").dialog({
       autoOpen: false,
       modal: true,
       title: "Image Full Size",
       draggable: true,
       resizable: false,
       show: 100,
       width: 900,
       height: 680,
       buttons:
      {
           "Ok": function () {
             $.ajax({ type: "GET",
             contenttype: "application/json; charset=utf-8",
            data: "{null}",
           url: "WebService1.asmx/loadInfo",
           dataType:"json",
            success: function(res) {
           // Do something means binding data
     },
     error: function(err) {
     alert(err);
 }
   });   
         $(this).dialog("close");
        },
        "Cancel": function () {
            $(this).dialog("close");
        }
      }
 });