tags:

views:

49

answers:

1

Hi, I have Telerik grid control, there I have an edit control like update and cancel buttons and so on.

The edit controls are shown automatically when I edit image click, no manual coding used to invoke the controls. Therefore my problem is I have to validate the input control when I update button click. The controls are created dynamically. So I used its client id value to make it functioning. But I could not do. I used the below code.

   $('#RadGrid1_ctl00_ctl05_btnUpdate').click(function() {
        alert("hai..Update Button");
        //Here I have to validate input controls
    });

-Thanks

+2  A: 

You can use a partial attribute selector to find an element whose id attribute contains the ID you've assigned to the control:

$('[id$=btnUpdate]').click(funciton () {
  alert('hai ... Update Button');
});

This will bind to any element whose id attribute ends with 'btnUpdate'.

If your grid control is dynamic, you might have to use the live() event binder like so:

$('[id$=btnUpdate]').live('click', funciton () {
  alert('hai ... Update Button');
});
brianpeiris
Hi i tried the above it is not working fine.Is there any other way to do it....
You might want to try using `live()` instead, if your grid is dynamic. I've updated my answer.
brianpeiris