Problem when loading data in a table

1

I have the following page:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="row-fluid">
      <div class="col-lg-12">
        <h4 class="page-header">Productos</h4>
      </div>
    </div>
<div class="container-fluid"></div>
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><span class="fa fa-address-book-o"></span><b> Lista de Productos</b></h3>
        </div>
        <div class="panel-body">
          <p class="btnform btn btn-info btn-sm" data-toggle="modal" data-target="#new" id="btnform" onclick="View();"><span class="glyphicon glyphicon-plus"></span> Nuevo Cliente</p><br><br>
          <div class="table-responsive">
              <table id="data-table-content" class="table table-hover table-condensed table-bordered">
                  <thead><tr><th>ID Producto</th><th>Nombre Producto</th><th>Categoria</th><th>HTS</th><th>Aduana</th><th>Precio</th><th>Opciones</th></tr></thead>
                  <tbody>
                      <asp:Literal ID="Literal1" runat="server"></asp:Literal>
                  </tbody>
              </table>
          </div>
        </div>
        <div class="panel-footer">
        </div>
      </div>
    </div>

What it does is show the data of a query to the database in a table, inside the tbody I have a literal that I charge with the following call:

protected void Page_Load(object sender, EventArgs e)
{
    Literal1.Text = ObjProductsController.verTabla();
}

This in turn calls a method, where I load the rows of said DataTable in the following way:

public string verTabla()
{
    //Iniciar conexion con la BD Productos
    ProductsConnector ObjProductsConnector = new ProductsConnector(false);

    //Iniciamos la lista de Productos
    IList<ProductsDAO> resultList = new List<ProductsDAO>();

    string html = string.Empty;
        resultList = ObjProductsConnector.findAll();
        //Llenado de datos (tabla) con la lista que se recupero anteriormente
        foreach (ProductsDAO item in resultList)
        {
            string code = (item.idProducto).Trim();
            html += "<tr><td>" + code + "</td>";
            html += "<td>" + item.nombreProducto.Trim() + "</td>";
            html += "<td>" + item.categoria + "</td>";
            html += "<td>" + item.HTS + "</td>";
            html += "<td>" + code + "</td>";
            html += "<td>" + item.precio1 + "</td>";
            html += "<td><p class='text-success btn' id='btnupd' data-toggle='modal' data-target='#new' onclick='return Update(\"" + code + "\");'><span class='glyphicon glyphicon-edit'> Modificar</span></p><br>";
            html += "<p class='text-danger btn' id='btndelete' onclick='return Delete(\"" + code + "\");'><span class='glyphicon glyphicon-trash'> Borrar</span></p></td></tr>";
        }
    ObjProductsConnector.SQLConnection.Close();
    return html;
}

The previous method sends me to call what is another method where I have the query SQL of a SELECT which brings me about 900 records.

My problem is that when I load the page everything goes very well, but after a few seconds the page hangs up and I can not select anything or move or anything, the page freezes completely. I would like to see if you know any solution to that problem. Since I have two more DataTable and yes they work well but only with one record, I do not know if it is because there are many records or where the problem lies. I would appreciate if you could support me.

I get the following error

Failed to load: 26373 / __ browserLink / requestData / 41acf70040fd4836bbde8ae3095a25d9 resource: the server responded with a status of 404 (Not Found)

    
asked by Miguel 19.06.2017 в 20:02
source

1 answer

0

You could also improve the performance by loading the table only once, when loading the page:

  protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Literal1.Text = ObjProductsController.verTabla();
        }
    }
    
answered by 20.06.2017 в 16:01