Client side help required

3 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    376 posts
    Member since:
    Aug 2008

    Posted 18 Jan 2016 Link to this post

    On My RadGrid I have a checkbox column

    <telerik:GridTemplateColumn UniqueName="colPrimaryProcedure" HeaderText="" ItemStyle-HorizontalAlign="Center"><HeaderStyle  HorizontalAlign="Center"  />
      <asp:checkbox ID="chkPrimary" runat="server" />

    In the itemDatBound event I'm ading an onCLick attribute to fire a Javascript function.

    Case "Treatment Codes"
     chkPri.Attributes.Add("onclick", [String].Format("setTreatment(this);"))
     chkPri.Text = "<span style='font-size:0px;line-height:0px;'>" & e.Item.DataItem("SpecialtyProcedureId") & "</span>"
    In the Javascript file I'm getting the clicked on row, and also selecting a value in a RadComboBox, with Checkboxes set to true, and for each ticked row in the Rad Grid, I'm able to select a value in the combo box. This all works as expected.

    var checkBox = document.getElementById(;
    var checkboxText = checkBox.parentElement.innerText.trim();


    What I want to do is if a box in unticked in the grid, is to un slect the row in the combo box, I'd have expected the following to work, but it doesn't.

    I'm using an old version of the controls 2014.2.618.40 and can't update because of breaking changes in the newer version.

    Can anyone help.

  2. Andy Green
    Andy Green avatar
    376 posts
    Member since:
    Aug 2008

    Posted 19 Jan 2016 in reply to Andy Green Link to this post

    Hi Guys

    I have sorted this now - I had a var declared in the wrong place in my JS and was out of scope at the time I was trying to use it.


  3. Eyup
    Eyup avatar
    3953 posts

    Posted 20 Jan 2016 Link to this post

    Hello Andy,

    Generally, when a control is placed within a Content Page, RadGrid Template or another container which implements INamingContainer interface, its UniqueID and ClientID are modified, thus making it inaccessible on main Page level. The problem is similar when using server-side expressions like <%=txtTrackingNumber.ClientID%> in external JS files, which are not allowed.

    On server-side, you need to use the FindControl method to access the control. You can use the
    GridEditableItem item = RadGrid1.EditItems[0] as GridEditableItem; approach to get the currently edited item.

    On client-side, you have several options to resolve this:

    1. Hardcode the ClientID of the controls as the argument for $find() method.

    2. Find the control using the findControl or findElement methods:
    $telerik.findControl(document.documentElement, "txtTrackingNumber");

    3. Use the client-side event handlers of the Telerik controls to get a reference to their objects:
    Copy Code
    <telerik:RadButton ... OnClientLoad="buttonLoad">
    Copy Code
    var button;
    function buttonLoad(sender, args) {
        button = sender;

    In your case, you can use the second suggestion as an alternative to the global variables.

    I hope this information will prove helpful.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top