You cannot use 'TemplateControl.FindControl()'
You'd rather be using GridView1.Rows[x].FindControl().
ASP.Net assigns a different id for text box in each row. You may have to loop thru each for its id.
You could do that on the server side with a loop.
But the only way to do it in javascript is to check the id of the textbox in the generated html & follow it
In your case the textboxes may be named like
GridView1_ctl02_txtState (for the first row) and it increments to ..ctl03.., ..ctl04.. & so on. The id will be different if you're keeping the gridview in another container.
Check the id & loop in javascript
Eg:
var i = 2;
var txt;
while(1)
{
txt =document.getElementById('GridView1_ctl0' + i.toString() + '_txtState');
if(txt!=null)
{
}
else
{
break;
}
}
And if the control id goes beyond ctl09, you must remove the '0' (must continue with ctl10 not ctl010). A little tweak required there.