I managed to get my jquery ui Dialog working from codebehind. Now I am facing another problem.
I have a gridview inside a div that is used for .dialog (). This gridview does not appear inside the dialog box.
If I introduce another control as an asp button: it shows, so I'm a bit confused. For instance:
<div id="DivMostrarIguales" title="Número Único Igual"> <asp:Button ID="Hello" runat="server" Text="Hello" /> <asp:GridView ID="gvMostrarIgualesEntrante" ...
In this case, the dialog loads and has a button visible, but not gridview.
I call MostrarVentanaMostrarVentanaIgualesEntrante from this button:
<asp:Button ID="btMostrarIgualesEntrante" runat="server" Text="Revisar si ya existe" OnClick="MostrarVentanaIgualesEntrante" ValidationGroup="none" CausesValidation="false" CssClass="Button" />
Everything is inside the update panel.
I checked the data that is used to bind the data and contains one row, so gridview has data.
Can anybody help me? Thanks.
My code is:
<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>
My.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(); }