This seems to be a common question in various forums
There is a clear distinction between accessing data in TemplateField and a BoundField
For BoundFields, it is straight forward:
string s = dgMyItems.SelectedRow.Cells[1].Text; // to access the second column of the selected row
For TemplateFields, use the following
string s = ((System.Web.UI.WebControls.Label)dgMyItems.SelectedRow.Cells[2].FindControl(“lblName”)).Text;
Assuming that you defined a label in the templatefield definition for the datagrid, with id = lblName
for example,
<ItemTemplate>
<asp:Label ID=”lblName” runat=”server” Text=’<%# Bind(“MyItemName”) %>’></asp:Label>
</ItemTemplate>
— Repost from Manoj’s blog