Reputation: 941
I found the following code in one of the old messages in StackOverflow:
$("#<%=GridView1.ClientID%> tr").click(function(){
alert("Row clicked");
});
The code above is supposed to call an alert when user clicks in a row of a GridView. What I don't understand, is how to define (in my GridView) what is referred in the above code as "ClientID". What is "ClientID"?
Upvotes: 0
Views: 152
Reputation: 66649
This code <%=GridView1.ClientID%>
will be run on server and will be final render as the ID of the grid view, so on the page you will final see probably this
$("#GridView1 tr").click(function(){
alert("Row clicked");
});
The ClientID
gives the final ID that the GridView is use on the html page.
Upvotes: 1