在jquery ui Dialog里面的gridview

时间:2011-03-28 20:38:11

标签: jquery asp.net jquery-ui gridview jquery-ui-dialog

我设法从代码隐藏中获取我的jquery ui Dialog。现在我面临另一个问题 我在div中使用了一个gridview,用于.dialog()。该网格视图未显示在对话框内 如果我输入另一个控件作为asp:按钮它确实显示,所以我有点困惑。 例如:

<div id="DivMostrarIguales" title="Número Único Igual">
            <asp:Button ID="Hello" runat="server" Text="Hello" />
            <asp:GridView ID="gvMostrarIgualesEntrante" ...

在这种情况下,对话框会加载并显示按钮,但不会显示网格视图。

我从这个按钮调用MostrarVentanaMostrarVentanaIgualesEntrante:

<asp:Button ID="btMostrarIgualesEntrante" runat="server" Text="Revisar si ya existe"
                                                    OnClick="MostrarVentanaIgualesEntrante" ValidationGroup="none" CausesValidation="false"
                                                    CssClass="Button" />

一切都在更新面板内。

我检查了用于绑定数据的数据表,它包含一行,因此gridview确实有数据。

有人可以帮我吗? 谢谢。

我的代码:

<div id="DivMostrarIguales" title="Número Único Igual">
            <asp:GridView ID="gvMostrarIgualesEntrante" runat="server" AutoGenerateColumns="false"
                EmptyDataText="No se encontraron documentos." PageSize="10" AllowPaging="true"
                DataKeyNames="DocumentoEntranteID" Visible="true" CssClass="tablaGrid">
                <Columns>
                    <asp:CommandField ButtonType="Image" SelectImageUrl="/images/UncheckedRadio.gif"
                        ShowSelectButton="True" />
                    <asp:BoundField DataField="DocumentoEntranteID" HeaderText="ID" SortExpression="DocumentoEntranteID"
                        ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30px"></asp:BoundField>
                    <asp:BoundField DataField="FechaIngreso" HeaderText="Ingreso" SortExpression="FechaIngreso"
                        ItemStyle-HorizontalAlign="Center" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false"
                        ItemStyle-Width="130px"></asp:BoundField>
                    <asp:BoundField DataField="FuncionarioRecibe" HeaderText="Recibe" SortExpression="FuncionarioRecibe"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="NumeroOficio" HeaderText="Número Oficio" SortExpression="NumeroOficio"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="NumeroUnico" HeaderText="Número único" SortExpression="NumeroUnico"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="Remitente" HeaderText="Remitente" SortExpression="Remitente"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="OficinaRemitente" HeaderText="Oficina" SortExpression="OficinaRemitente"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="Dirigido" HeaderText="Dirigido" SortExpression="Dirigido"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="Asignado" HeaderText="Asignado" SortExpression="Asignado"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="OficinaArea" HeaderText="Oficina Recibe - Área" SortExpression="Area"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                    <asp:BoundField DataField="EstadoDocumento" HeaderText="Estado Documento" SortExpression="EstadoDocumento"
                        ItemStyle-HorizontalAlign="Left"></asp:BoundField>
                </Columns>
            </asp:GridView>
        </div>

我的.CS:

private void CargarGridMostrarIgualesEntrante()
    {
        //revisar que el texto del textbox vaya con su formato correcto.
        if (Regex.IsMatch(tbNumeroUnico.Text, @"\d{2}-\d{6}-\d{4}-\w\w"))
        {
            lbNumeroUnicoEntrante.Visible = false;

            //cargar solo los documentos entrantes que tengan ese mismo número único.
            _documentosEntrantesNumeroUnicoIgual = _documentosHandler.ObtenerDocumentosEntrantesPorNumeroUnico(tbNumeroUnico.Text);

            if (_documentosEntrantesNumeroUnicoIgual.Count > 0)
            {
                DataTable table = new DataTable();
                table.Columns.Add(new DataColumn("DocumentoEntranteID", typeof (long)));
                table.Columns.Add(new DataColumn("FechaIngreso", typeof (DateTime)));
                table.Columns.Add(new DataColumn("FuncionarioRecibe", typeof (string)));
                table.Columns.Add(new DataColumn("NumeroOficio", typeof (string)));
                table.Columns.Add(new DataColumn("NumeroUnico", typeof (string)));
                table.Columns.Add(new DataColumn("Remitente", typeof (string)));
                table.Columns.Add(new DataColumn("OficinaRemitente", typeof (string)));
                table.Columns.Add(new DataColumn("Dirigido", typeof (string)));
                table.Columns.Add(new DataColumn("Asignado", typeof (string)));
                table.Columns.Add(new DataColumn("OficinaArea", typeof (string)));
                table.Columns.Add(new DataColumn("EstadoDocumento", typeof (string)));

                foreach (DocumentoEntrante documentoEntrante in _documentosEntrantesNumeroUnicoIgual)
                {
                    DataRow row = table.NewRow();
                    row["DocumentoEntranteID"] = documentoEntrante.DocumentoEntranteID;
                    row["FechaIngreso"] = documentoEntrante.FechaIngreso;
                    row["FuncionarioRecibe"] = documentoEntrante.FuncionarioRecibe.NombreFuncionario;
                    row["NumeroOficio"] = documentoEntrante.NumeroOficio;
                    row["NumeroUnico"] = documentoEntrante.NumeroUnico;
                    row["Remitente"] = documentoEntrante.Remitente;
                    row["OficinaRemitente"] = documentoEntrante.Oficina.Nombre;
                    row["Dirigido"] = documentoEntrante.FuncionarioDirigido.NombreFuncionario;
                    row["Asignado"] = documentoEntrante.FuncionarioAsignado.NombreFuncionario;
                    row["OficinaArea"] = documentoEntrante.Area.Oficina.Nombre + " - " +
                                         documentoEntrante.Area.Nombre;
                    row["EstadoDocumento"] = documentoEntrante.EstadoDocumento.Nombre;

                    table.Rows.Add(row);
                }

                gvMostrarIgualesEntrante.DataSource = table;
                gvMostrarIgualesEntrante.DataBind();
            }else
            {
                gvMostrarIgualesEntrante.DataSource = null;
                gvMostrarIgualesEntrante.EmptyDataText = "No existe un documento entrante con el mismo número único";
                gvMostrarIgualesEntrante.DataBind();

            }
            runjQueryCode("dlg = $('#DivMostrarIguales').dialog({autoOpen: false,show: 'fold',hide: 'clip',width: 1272,height: 211,close: function(ev, ui) { $('.ui-effects-wrapper').remove(); }}); $('#DivMostrarIguales').dialog('open')");
        }
        else
        {
            lbNumeroUnicoEntrante.Visible = true;
        }
    }

protected void MostrarVentanaIgualesEntrante(object sender, EventArgs e)
    {
        CargarGridMostrarIgualesEntrante();
    }

1 个答案:

答案 0 :(得分:0)

我认为这是因为来自UpdatePanel的回发,其原因可能源于mentioned here

很高兴知道它对你有用。

相关问题