Pass the ids of the elements into your javascript function
<asp:GridView ID="GridView2" runat="server" C AutoGenerateColumns="False" Width="100%">
<Columns>
<asp:TemplateField HeaderText="text1" >
<ItemTemplate>
<asp:TextBox ID="txt1" runat="server" onclick='<%#string.Format("javascript:BindCheckboxlist(\"{0}\", \"{1}\")", ((GridViewRow) Container).FindControl("txt1").ClientID, ((GridViewRow) Container).FindControl("txt2").ClientID) %>' Text='<%# Bind("txt1") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="text2" >
<ItemTemplate>
<asp:TextBox ID="txt2" runat="server" Text='<%# Bind("txt2") %>'></asp:TextBox>
</ItemTemplate>
<ControlStyle Width="150px" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<script>
function BindCheckboxlist(txt1ID, txt2ID) {
var txt1 = document.getElementById(txt1ID);
var txt2 = document.getElementById(txt2ID);
var row = txt1.parentNode.parentNode;
var controls = row.getElementsByTagName("*");
for (var i = 0; i < controls.length; i++) {
if (controls[i].id.indexOf("txt1") != -1) {
txt1= controls[i];
alert(txt1.value);
}
if (controls[i].id.indexOf("txt2") != -1) {
txt2= controls[i];
alert(txt2.value);
}
}
}
</script>