tags:

views:

30

answers:

3

I have an ASP page which displays a text box when it loads. It takes an input number, send it to the server through post back, and then displays some record in a grid view. After a number is input into the box, the server fetches some data from a database and add records to the grid view. It also contains a link column, whose URL is set to "#", so that the page isn't redirected when it is clicked.

Now I want to bind a jquery "click" event to that link. How can I do that ? I have tried that to do myself but failed, because it is not available when the DOM is loaded (since it only contains rows when a number is input through the box), and is being modified through ASP.NET Ajax post back.

+2  A: 

i think you're looking for .live.

j.
+3  A: 

You should be able to use the live handlers in jQuery to do this. I'd give these links a specific class to uniquely identify them and make it easier.

 $('a.gridLink').live('click', function() {
     ... perform your action...
     return false; // to cancel the default click action
 });
tvanfosson
Thank you very very very very very(.......) much......... :d
Night Shade
+2  A: 

You need to call the live function:

$('#<%=myGrid.ClientID%> a').live("click", function(e) {
    //Do things
    return false;  //You don't need to set the href to #
});
SLaks