I'm trying to call an **External JavaScript Function** that accept 3 parameters as below:

```
function CalculateSum(grdID, hiddenID, TargetColumnIndex) {
    debugger;
    var oDataGrid = document.getElementById("<%= grdID.ClientID %>");
    var tableRows = oDataGrid.rows;
    var sum = 0;
    for (var i = 1; i < tableRows.length; i++) {
        var col1 = oDataGrid.rows[i].cells[TargetColumnIndex];
        for (j = 0; j < col1.childNodes.length; j++) {
            if (col1.childNodes[j].type == "text") {
                if (!isNaN(col1.childNodes[j].value) && col1.childNodes[j].value != "") {
                    sum += parseInt(col1.childNodes[j].value)
                }
            }
        }
    }
    if (!isNaN(sum)) {
        document.getElementById('<%=hiddenID.ClientID %>').value = sum;
    }
}

```

And this is how i did call it:

```
<asp:Button ID="btnSave" runat="server" CssClass="btn btn-primary" 
    OnClientClick="CalculateSum('grdPlanObjectivesStandardWeights', '#hidden', 2);" 
    OnClick="btnSave_Click" 
    Text="<%$Resources:DCAACommon, Save%>" 
    ValidationGroup="SaveStandardWeight" />

```

**Notes:**

* When i run this code i have an error says: `'CalculateSum' is undefined`.
* The parameters i'm trying to pass are:

`grdPlanObjectivesStandardWeights` is a `asp:GridViewID`.

`hidden` is a `asp:HiddenFieldID`.

`2` is an int value.
* I can't even debug this function.
* The function defined here: `<script src="../../Common/Scripts/SummationOfAGridviewColumnValues.js"></script>`

What is wrong with my code/approach?