Get value from GridView when a button is clicked
<p>I have a GridView , and the GridView has an item template. Now I need to get the value of the first cell which contains the value I need but I have tried the following and does not work, it eturns a ""</p>

<pre><code> int id = Convert.ToInt32(GridView.Rows[index].Cells[0].Text);
</code></pre>

<p>Here is the code I have in the gridview</p>

<pre><code>&lt;Columns&gt;
   &lt;asp:TemplateField HeaderText="ID"&gt;
         &lt;ItemTemplate&gt;
             &lt;asp:Label runat="server" ID="lblDepartmentID" Text='&lt;%#DataBinder.Eval(Container.DataItem,"DepartmentID")%&gt;' /&gt;
                                        &lt;/ItemTemplate&gt;
                                        &lt;HeaderStyle HorizontalAlign="Left" /&gt;
      &lt;/asp:TemplateField&gt;
</code></pre>

<p>I have to emphazise that I do not want to use the GridView_RowCommand or other GridView events.. I need to pull this value upon clicking a button on the same page.</p>

<p>How can I do this?</p>
