To make it some simple you can set "
ClientIDMode="Static"
to your controls inside gridview. This will allow you to use same "ID" you set for control in Javascript.
E.g. Assuming I have LinkButton control with ID 'link1' inside Gridview control. If ClientIDMode is set to Static you can aceess this control with same id 'link1'.
If this property not set to static ASP.NET will have control loaded with something like '
GridView1_link1_0
' and you need to have code in javascript like you are tryinh now.