Good day to all,

i would like ask how to sum column in gridview. I follow the below link to add row and achieved. but now i want sum the column in gridview

http://www.aspsnippets.com/Articles/Dynamically-Add-Rows-to-GridView-using-JavaScript-on-Button-Click-in-ASPNet.aspx

  var fields = document.getElementsByClassName('lblweifght');
    var sum = 0;
    for (var i = 0; i < fields.length; ++i) {
        var item = fields[i];
        sum += parseInt(item.value);
    }
    $("#<%= totalHours.ClientID %>").val(sum);

<asp:Label runat="server" ID="lblWeightQ" Text='<%# Eval("WeightValue")==DBNull.Value ? Convert.ToInt32(0) : Eval("WeightValue") %>' ClientIDMode="Static" CssClass="items"></asp:Label>

Above code run when the postback

how to achieve please advise. i want sum each time add row into gridview

Related posts

Recent Viewed