Get the value of a hidden column in a gridview with javascript
<p>I have a function (below) that works wonderful but now I need to hide the column 'CustomerID' which gives me the value for var CustomerID = grid.rows[i].cells[1].innerText; If I hide this column the function no longer works well it works but it's grabbing the wrong value. Can anyone help with this?</p>

<p>The hidden field looks like this...</p>

<pre><code>&lt;asp:TemplateField&gt;
  &lt;ItemTemplate&gt;
    &lt;asp:Label id="lblCustomerId" runat ="server" text='&lt;%# Eval("CustomerID")%&gt;'/&gt;
  &lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;
</code></pre>

<p>function:</p>

<pre><code>function mapSelectedClick() 
{
    var customerIDs = "";
    var grid = document.getElementById('&lt;%=grdCustomers.ClientID %&gt;');
    var count = 0;

    for (var i = 1; i &lt; grid.rows.length; i++)
    {
        var cell = grid.rows[i].cells[0];

        var CustomerID = grid.rows[i].cells[1].innerText;
        for (var j = 0; j &lt; cell.childNodes.length; j++)
        {
            if (cell.childNodes[j].type == "checkbox")
            {
                if (cell.childNodes[j].checked)
                {
                    customerIDs += CustomerID.toString() + ',';
                    count++;
                }
            }
        }
    }

    if (count == 0)
    {
        alert("Please select at least one customer to map.");
        return false;
    }

    customerIDs = customerIDs.substring(0, customerIDs.length-1);
    window.open("MapCustomers.aspx?CustomerIDs=" + customerIDs);
}
</code></pre>
