Having trouble finding a simple control handle

2 posts, 0 answers
  1. Boris
    Boris avatar
    275 posts
    Member since:
    Oct 2012

    Posted 13 Nov 2014 Link to this post

    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?
  2. Boris
    Boris avatar
    275 posts
    Member since:
    Oct 2012

    Posted 13 Nov 2014 in reply to Boris Link to this post

    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);
                           }
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top