Just Missing : OnRowDataBound="GridView1_RowDataBound"
In your Gridview control
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
AllowSorting="True"
onselectedindexchanged="GridView1_SelectedIndexChanged"
DataKeyNames="TempID">