I have a SqlDataSource dsDetails that selects from the DB table. 

```
<asp:SqlDataSource ID="dsDetails" runat="server" SelectCommand="spGetDetails" 
OnSelected="dsDetails_Selected" SelectCommandType="StoredProcedure">
<SelectParameters>
    <asp:QueryStringParameter Name="mode" QueryStringField="mode" Type="String" DefaultValue="NULL" />
</SelectParameters>
</asp:SqlDataSource>

```

The result is bound to gridview in the aspx page 

```
<asp:GridView  CssClass="content" ID="gridDetails" runat="server" DataSourceID="dsDetails" AllowSorting="True" AllowPaging="True" PagerSettings-Position ="TopAndBottom" DataKeyNames="ID" AutoGenerateColumns="False" >
        <PagerSettings Position="TopAndBottom" Mode="NumericFirstLast" />
        <EmptyDataTemplate>
            <b>There are no records to display.</b>
        </EmptyDataTemplate>        
        <Columns>
            <asp:BoundField DataField="empNum" HeaderText="Employee Number" SortExpression="empnum" ApplyFormatInEditMode="True" HtmlEncode="False" ReadOnly="True" />
            <asp:BoundField DataField="empName" HeaderText="Emplopyee Name" SortExpression="empname" ApplyFormatInEditMode="True" HtmlEncode="False" ReadOnly="True" />                
            <asp:BoundField DataField="empDoj" HeaderText="Emplopyee Date of joining" SortExpression="empdoj" ApplyFormatInEditMode="True" HtmlEncode="False" ReadOnly="True" />                
            <asp:TemplateField HeaderText="Salary" SortExpression="sal">
                <EditItemTemplate>
                    <asp:TextBox ID="txtSal" runat="server" Text='<%# Eval("sal", "{0:F}") %>'></asp:TextBox>                        
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Eval("sal", "{0:C2}") %>'></asp:Label>--%>
                </ItemTemplate>
            </asp:TemplateField>                
            <asp:TemplateField>
                <EditItemTemplate>
                    <asp:Button ID="btnSave" runat="server" CausesValidation="True" CommandName="cmdSave"
                        Text="Save" />&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CausesValidation="False" CommandName="cmdCancel" 
                        Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>                    
                    <asp:Button ID="btnApprove" runat="server" CausesValidation="False" CommandName="cmdApprove"
                        Text="Approve" />&nbsp;
                    <asp:Button ID="btnEdit" runat="server" CausesValidation="False" CommandName="cmdEdit"
                        Text="Edit" />&nbsp;
                    <asp:Button ID="btnDelete" runat="server" CausesValidation="false" CommandName="cmdDelete"
                        Text="Delete" />
                    <ajaxToolkit:ConfirmButtonExtender ID="cbeDelete" runat="server" 
                        TargetControlID="btnDelete"
                        ConfirmText="Are you sure?" />   
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView> 

```

Now what i have to achieve is Find the Sum of the Salary Column of the grid view. How to achieve this using the Data Source in the page load method? I have to get the sum of Salary for the entire result set (avg records returned 60-80)

Iterating through the rows and computing the sum in gridDetails\_RowDataBound wont be effective since the rows.count will be max of 10 since the page size is 10. When the result set has more than 10 records say 55, It will compute the sum for the current gridview page alone (first 10 records). I have to get the sum for all 55 records and display it in a label in the pageload method.

Please provide suggestion..