This is a migrated thread and some comments may be shown as answers.

Having trouble finding a simple control handle

1 Answer 60 Views
Button
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 13 Nov 2014, 03:34 PM
I'm having a hard time just finding the handle to a RadButton.  I've tried every Javascript/jQuery technique I can think of but no luck.

I have RadButtons set up as checkboxes in rows of 3 in an Asp:Repeater.

On the OnClientClicked event I call a Javascript function.  The first thing it does is call sender.get_uniqueID() which returns a string like rp1$ctl05$chkSelect.

Once I have that it's a simple matter to parse the string to assemble the unique IDs of the other checkboxes in the row.

Unfortunately no technique I can think of will return a handle that will allow me to do a set_checked call on either of the other checkboxes in the row.  It's always null.

Suggestions?

1 Answer, 1 is accepted

Sort by
0
Boris
Top achievements
Rank 1
answered on 13 Nov 2014, 06:26 PM
Apologies.  A bit too quick on the append here.  :-)

I didn't understand the problem until I found this: 
http://stackoverflow.com/questions/1612016/c-sharp-asp-net-why-is-there-a-difference-between-clientid-and-uniqueid  
(and a couple more like that.)

The problem was that I was trying to do finds with the original unique Id and apparently the $ signs in the string mess up Javascript.

So finally in summary, if anyone's interested:

calling from OnClientClicked='testChk'

  function testChk(sender, args) {
                         var senderId = sender.get_uniqueID().split("$");                  
                        if (sender.get_checked()) {                                                        
                            var base = senderId[0] + '_' + senderId[1]+ '_';  
                           var chkSelect = = $find(base + 'chkSelect');
                           chkSelect.set_checked(false);
                       }
}
Tags
Button
Asked by
Boris
Top achievements
Rank 1
Answers by
Boris
Top achievements
Rank 1
Share this question
or