简体   繁体   English

回发在JQuery对话框中不起作用

[英]Postback is not working in JQuery dialog

Hello I have the following problem I tried and nothing , I can not recover my text box user control , the TexBox will use them in the EDIT POPUP 您好,我尝试了以下问题,但一无所获,我无法恢复我的文本框用户控件,TexBox将在编辑弹出窗口中使用它们

CONVENIO.ASPX 便捷的ASPX

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="convenios.aspx.cs" Inherits="convenios5.convenios" %>
<%@ Register TagPrefix="ModalPopup" TagName="detalle" Src="~/UserControls/Popup_conveniodetalle.ascx"%>
<%@ Register TagPrefix="ModalPopup" TagName="editar" Src="~/UserControls/Popup_conveniomodificar.ascx"%>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <link href="Styles/GridStyle.css" rel="stylesheet" type="text/css" />
    <%--<link href="Styles/bootstrap.css" rel="stylesheet" type="text/css" />--%>
    <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
    <link href="http://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>


<%-- CERRAR DIALOG UI --%>
<script type="text/javascript">
            function closeDialog() {
                $("#divmodificar").dialog('close');
            }
</script>

</head>

<body>
    <form id="Form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
        <div class="panel panel-default">
        <div class="panel-heading">
            <h3>:: CONVENIOS CLINICA CAYETANO ::</h3>
        </div>

        <div class="panel-body">
             <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
                <ContentTemplate>


                    <table width="100%">
                        <tr id="trMessage" runat="server" visible="false">
                            <td>
                                <asp:Label ID="lblMessage" runat="server" Text="No hay datos que mostar"></asp:Label>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <asp:GridView ID="gridconvenios" runat="server" AllowPaging="true" PageSize="5"
                                    CssClass="GridStyle" BorderColor="#cbcbcb" BorderStyle="solid" OnRowCommand="gridconvenios_RowCommand" OnPageIndexChanging="gridconvenios_PageIndexChanging"
                                    BorderWidth="1" AutoGenerateColumns="false" DataKeyNames="COD_CONVENIO" width="100%">
                                    <AlternatingRowStyle CssClass="GridStyle_AltRowStyle" />
                                    <HeaderStyle CssClass="GridStyle_HeaderStyle" />
                                    <RowStyle CssClass="GridStyle_RowStyle" />
                                    <pagerstyle cssclass="GridStyle_pagination" />
                                    <Columns>


                                        <asp:TemplateField HeaderText="CODIGO"> 
                                            <ItemStyle HorizontalAlign="Center" width="5%" />    
                                            <ItemTemplate>
                                                <asp:LinkButton ID="cmddetalle" runat="server" CausesValidation="False" Text='<%# Eval("COD_CONVENIO") %>' CommandName="detalle" CommandArgument='<%# Eval("COD_CONVENIO") %>' ></asp:LinkButton>
                                            </ItemTemplate>                           
                                        </asp:TemplateField> 


                                        <asp:TemplateField HeaderText="ENTIDAD"> 
                                            <ItemStyle width="20%" />    
                                            <ItemTemplate>
                                                <asp:Label ID="lblRequiredDate" runat="server" Text='<%# Eval("DES_IAFA") %>'></asp:Label>
                                            </ItemTemplate>                           
                                        </asp:TemplateField>   
                                        <asp:TemplateField HeaderText="CONVENIO"> 
                                            <ItemStyle HorizontalAlign="Center" width="10%" />    
                                            <ItemTemplate>
                                                <asp:Label ID="lblShippedDate" runat="server" Text='<%# Eval("DES_CONVENIO") %>'></asp:Label>
                                            </ItemTemplate>                           
                                        </asp:TemplateField>    
                                        <asp:TemplateField HeaderText="INICIO"> 
                                            <ItemStyle width="5%" />    
                                            <ItemTemplate>
                                                <asp:Label ID="lblShipName" Text='<%# Eval("FEC_INI") %>' runat="server"></asp:Label>
                                            </ItemTemplate>                           
                                        </asp:TemplateField>   
                                        <asp:TemplateField HeaderText="FIN"> 
                                            <ItemStyle width="5%" />    
                                            <ItemTemplate>
                                                <asp:Label ID="lblShipAddress" Text='<%# Eval("FEC_INI") %>' runat="server"></asp:Label>
                                            </ItemTemplate>                           
                                        </asp:TemplateField> 

                                         <asp:TemplateField HeaderText="FACTOR"> 
                                            <ItemStyle width="5%" />    
                                            <ItemTemplate>
                                                <asp:Label ID="lblfactor" Text='<%# Eval("IMP_FACTORHON") %>' runat="server"></asp:Label>
                                            </ItemTemplate>                           
                                        </asp:TemplateField> 

                                       <asp:TemplateField HeaderText="ESTADO"> 
                                            <ItemStyle width="5%" />    
                                            <ItemTemplate>
                                                <asp:Label ID="lblestado" Text='<%# Eval("EST_CONVENIO") %>' runat="server"></asp:Label>
                                            </ItemTemplate>                           
                                        </asp:TemplateField> 

                                        <asp:TemplateField> 
                                            <ItemStyle HorizontalAlign="Center" width="5%" />    
                                            <ItemTemplate>
                                                <asp:ImageButton ID="cmdEdit" CommandName="editar" CommandArgument='<%# Eval("COD_CONVENIO")%>' runat="server" ImageUrl="~/images/edit.gif" CausesValidation="False"></asp:ImageButton>
                                                <asp:ImageButton ID="cmdDelete" CommandName="eliminar" CommandArgument='<%# Eval("COD_CONVENIO")%>' runat="server" ImageUrl="~/images/delete.gif" CausesValidation="False"></asp:ImageButton>
                                            </ItemTemplate>                           
                                        </asp:TemplateField>                
                                    </Columns>                  
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>



            <div id="divmodificar" style="display:none;">
               <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                    <ContentTemplate>
                        <ModalPopup:editar ID="ucmodificar" runat="server" />
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="gridconvenios" EventName="RowCommand" />  
                    </Triggers>
                </asp:UpdatePanel>
            </div>




        </div>
    </div>



</form>


</body>
</html>

CONVENIOS.ASPX.CS 便捷的ASPX.CS

protected void gridconvenios_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
{
    string COD_CONVENIO = Convert.ToString(e.CommandArgument);

    switch (e.CommandName.ToLower())
    {
         case "editar":
            System.Text.StringBuilder sb1 = new System.Text.StringBuilder();            
            sb1.Append("<script type='text/javascript'>");
            sb1.Append("     $(\"#divmodificar\").dialog({");
            sb1.Append("     title: \"EDITAR CONVENIO: " + COD_CONVENIO + "\",");
            sb1.Append("position:'center', width:'auto', autoresize:true, modal:true,");
            sb1.Append("open: function(type,data) {");
            sb1.Append("$(this).parent().appendTo(\"form\");");
            sb1.Append("}");
            sb1.Append("});");
            sb1.Append("</script>");
            var ucmodificar1 = (convenios5.UserControls.Popup_conveniomodificar)ucmodificar;
            ucmodificar1.BindOrderDetail(COD_CONVENIO);
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModalScript1", sb1.ToString(), false);
            break;

    }
}

CONVENIOEDITAR.ASCX 便捷编辑器

<asp:Panel ID="Panel1" runat="server">
<fieldset>
    <legend>DATOS CONVENIO</legend>
<table width="100%">

    <tr>
        <td class="cabecera">CÓDIGO: </td>
        <td class="texto"><asp:Textbox ID="Text1" runat ="server"></asp:Textbox></td>

    </tr>


    <tr>
        <td class="cabecera">DESCRIPCIÓN: </td>
        <td class="texto"><asp:Textbox ID="Text2" runat="server" Width="80%"></asp:Textbox></td>        
    </tr>


    <tr>
        <td class="cabecera">FACTOR: </td>
        <td class="texto"><asp:Textbox ID="Text3" runat="server" Width="80%"></asp:Textbox></td>        
    </tr>

     <tr>
        <td class="cabecera">ESTADO: </td>
        <td>
            <p>
            <asp:RadioButton ID="activo" runat="server" Text="Activo"/>
            <asp:RadioButton ID="inactivo" runat="server" Text="Inactivo"/>
            </p>
        </td>       
    </tr>

                                <tr>
                                <td colspan="2" align="right">

CONVENIOEDITAR.ASCX (HERE PROBLEM) CONVENIOEDITAR.ASCX(问题)

    protected void cmdAdd_Click(object sender, EventArgs e)
    {
        string VAR1 = this.Text1.Text;// THIS VAR1 IS NULL

    }

I can not capture the value of VAR1 appears to me as NULL. 我无法捕获VAR1的值,在我看来为NULL。

Please help me... 请帮我...

I would use the onClientClick property of the asp:LinkButton, and get the textbox value via jQuery 我将使用asp:LinkBut​​ton的onClientClick属性,并通过jQuery获取文本框值

<asp:LinkButton> ..   OnClientClick="GetText1Val();" </asp:LinkButton>

And the function: 和功能:

<script language="javascript">

    function GetText1Val() {

        var Text1Value =  $("#Text1").val();
        alert(Text1Value);

    }

</script>

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

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