jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了从codebehind打开jQuery Dialog大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
所以我必须从代​​码隐藏中显示一个jquery UI对话框.
我已经尝试了一切: this,this,this,并且还更改了这些答案以测试它是否适用于我但不起作用.
我正在使用第一个解决方案,因为它是有组织的.如果我使用alert(‘whatever’)而不是我的jquery对话框代码,它可以工作.所以我知道它的工作,但对话没有任何反应.我也尝试过用彩盒,也没用.

有人可以给我一个解决方法吗?这将是apreciated.
谢谢.

我的aspx:

HEAD
<script type="text/javascript">

    function BindEvents() {
        $.fx.speeds._default = 1000;
        $(document).ready(function () {                
            var dlg = $("#DivMostrarIguales").dialog({
                autoOpen: false,show: "fold",hide: "clip",width: 500,height: 500
            });
            dlg.parent().appendTo(jQuery("form:first"));
        });
    }

</script>
ENDHEAD
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:updatePanel runat="server" ID="up@R_849_10586@l">
    <ContentTemplate>
        <script type="text/javascript">
            Sys.Application.add_load(BindEvents);                
        </script>....
 <tr>
          <td class="Izquierda">
                (*) Número único:
          </td>
          <td class="Derecha">
             <asp:TextBox ID="tbNumeroUnico" runat="server"></asp:TextBox>
             <asp:Button ID="btMostrarIgualesEntrante" runat="server" Text="Revisar si ya existe"
                                                    OnClick="MostrarVentanaIgualesEntrante" ValidationGroup="none" CausesValidation="false"
                                                    CssClass="Button" />                 
             <asp:Label runat="server" ID="lbNumeroUnicoEntrante" Text="Debe digitar el formato correcto del número único (completo)"
                                                    Visible="false" CssClass="ErrorCampo"></asp:Label>
          </td>
       </tr>...
        <div id="DivMostrarIguales" title="Número Único Igual">
            whatEver              
        </div>           
    </ContentTemplate>
</asp:updatePanel>
</asp:Content>

我的.CS功能

private String getjQueryCode(String jsCodetoRun)
    {
        StringBuilder sb = new StringBuilder();
        sb.AppendLine("$(document).ready(function() {");
        sb.AppendLine(jsCodetoRun);
        sb.AppendLine(" });");

        return sb.ToString();
    }

    private void runjQueryCode(String jsCodetoRun)
    {

        ScriptManager requestSM = ScriptManager.GetCurrent(this);
        if (requestSM != null && requestSm.IsInAsyncPostBACk)
        {
            ScriptManager.RegisterClientScriptBlock(this,typeof(PagE),Guid.NewGuid().ToString(),getjQueryCode(jsCodetoRun),truE);
        }
        else
        {
            ClientScript.RegisterClientScriptBlock(typeof(PagE),truE);
        }
    }

    protected void MostrarVentanaIgualesEntrante(object sender,EventArgs E)
    {
        CargarGridMostrarIgualesEntrante();
        runjQueryCode("$('#DivMostrarIguales').dialog('open')");            
    }

解决方法

首先调用对话框来创建它.
.dialog({ autoOpen: false }) //{} = setTings

然后打开它..

.dialog('open')

大佬总结

以上是大佬教程为你收集整理的从codebehind打开jQuery Dialog全部内容,希望文章能够帮你解决从codebehind打开jQuery Dialog所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。