Ver Mensaje Individual
  #7 (permalink)  
Antiguo 16/07/2008, 10:44
alxrex
 
Fecha de Ingreso: junio-2008
Mensajes: 7
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: Problemas con el control Table con ASP .NET

Ahora que pasa si Manejo AJAX, ASP.NET y en el TABLE

quiero manjear una tabla dinamica


Tengo mi textbox.. y mi boton dentro de 1 updatepanel1
y en el updatepanel2 esta la tabla.....

Con la funcion de agragar row....
Pero soolo se agrega 1 Linea.

En esta pagina muestra como usarlos.... pero utilizando updatepanels de ajax, siempre me reimprime una tabla nueva...
http://msdn.microsoft.com/es-es/library/7bewx260(VS.80).aspx
¿Alguien sabe como agragar nuevo row sin perder los demas?
En esta Otra pagina viene algo de lo que necesito.... pero sin la complejidad del mismo
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ReorderList/ReorderList.aspx
---------------------
Código HTML:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="tabla.aspx.cs" Inherits="tabla" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <br />
        <asp:Table ID="TablaEstatica" runat="server">
        </asp:Table>
        <br />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Table ID="TablaDinamica" runat="server">
                </asp:Table>
                <asp:TextBox ID="tbDatos" runat="server"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Add" />
            </ContentTemplate>
        </asp:UpdatePanel>
    
    </div>
    </form>
</body>
</html> 
-----------------
Código:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class tabla : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TableRow fila;
        TableCell celda;
        
        for (int j = 0; j < 10; j++)
        {
            fila = new TableRow();
            for (int i = 0; i < 10; i++)
            {
                celda = new TableCell();
                celda.Text = "Celda " + i;
                fila.Cells.Add(celda);
            }
            TablaEstatica.Rows.Add(fila);
        }
        CONTADOR = 0;
    }

    private TableRow filas;
    private TableCell celdas;
    private int CONTADOR;
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        
        CONTADOR++;
        filas = new TableRow();
        
        celdas = new TableCell();
        celdas.Text = tbDatos.Text;
        
        filas.Cells.Add(celdas);
        TablaDinamica.Rows.AddAt(TablaDinamica.Rows.Count-1, filas);
        //TablaDinamica.Rows.Add(filas);
    }
}

Última edición por alxrex; 16/07/2008 a las 11:22