locked
ASP.NET Page size RRS feed

  • Question

  • User-289696211 posted

    I have a page with two gridviews to template item using HTML tables,  that refresh each 20 seconds that loads a realtime data from csv stream , when page is loaded the size is 30KB and it runs 24/7 , the admins reported that 30KB is consuming a lot of bandwidth over month and  the size should be optimized , I did all what I know to reduce white spaces, minimal use of control as I'm rendering data directly in cells,

    <img src='<%# GetStationStatus(Convert.ToString(Eval("Date")), Convert.ToString(Eval("Time"))) %>' /><font class="RTUnit2"> <%# Eval("Time") %> </font></td>
    <td style="background-color:azure;width:150px;text-align:right"><%# DataBinder.Eval(Container.DataItem, "Station") %></td>

    I'm using following method to reload the page, the concern I have is to reduce  the size

     

    $(document).ready(function pageCounter() {
        counter = 20;
        setInterval(function () {
            counter--;
            if (counter >= 0) {
                span = document.getElementById("counter");
                span.innerHTML = counter;
            }
            // Display 'counter' wherever you want to display it.
            if (counter === 0) {
                $("[id*=Button1]").click(); counter = 20;
            }
        }, 1000);
    });


     what do I need to make the size of my page smaller

     

    if any other information are needed please inform me

     

    BR

    Sunday, November 30, 2014 8:02 AM

Answers

  • User1918509225 posted

    Hi SharpRan,

    First, I suggest that you should disable the ViewState  of your controls in your gridview .It would be better to reduce the page size if you can disable the gridview ViewState without impacting on your programme.

    Second, I suggest that you can try to use Ajax to partical refresh your gridview so that you don't need to request a whole page from the server side.

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 30, 2014 9:37 PM