Getting ClientID for a GridTemplateColumn Item

5 posts, 0 answers
  1. Sintayehu
    Sintayehu avatar
    67 posts
    Member since:
    Jan 2013

    Posted 29 Sep 2008 Link to this post

    Hello,

    I am using GridTemplateColumns in which there are asp controls like checkboxes and textboxes....

    <telerik:GridTemplateColumn UniqueName="LocalUsageColumn" HeaderText="Local Usage" EditFormColumnIndex="1">

    <ItemTemplate>

    <asp:CheckBox id="DisabledLocalCheckBox" runat="server" Enabled="False" Checked='<%# Eval("LocalUsage") %>'></asp:CheckBox>

    </ItemTemplate>

    <EditItemTemplate>

    <asp:CheckBox id="EditableLocalCheckBox" runat="server" Checked='<%# Bind("LocalUsage") %>' Onclick="usageCheck('EditableLocalCheckBox');">
    </
    asp:CheckBox>

    </EditItemTemplate>

    </telerik:GridTemplateColumn>


    I have a javascript function that gets fired when the checkboxe state changes, I would like to know how to get the ClientID of the controls I have in the EditItemTemplate
    function usageCheck(sender){ }

    I have tried 

    $find(

    "<%= LocalUsageColumn.ClientID %>");

    But can't be found.

    My grid is in a page that inherits from a master page, So the ID for the controls looks something like .......
     ctl00_MasterPageContentPlaceHolder_RadGrid1_ctl00_ctl05_EditableLocalCheckBox

    But each editable Item in eachrow has diffrent ID (ctl00_ctl05, ctl00_ctl06, etc) so I can't hardcode it.

    Do you have a solution?

    I apreciate your reply in advance.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Sep 2008 Link to this post

    Hello Luay,

    You can go through the following code library submission link which demonstrates how to access GridTemplate Controls on the client side.
    Accessing server controls in a grid template on the client

    You can also go through the following code library submission link which demonstrates how to store the client id of the control editor in window object attribute (global scope variable) and then trace the control on the client using the document.getElementById(id) method.
    Retrieving grid editor value client side

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ravi
    Ravi avatar
    13 posts
    Member since:
    Oct 2008

    Posted 20 Dec 2008 Link to this post

    i try this one but now also its not working
  5. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 20 Dec 2008 Link to this post

    Hello Ravi,

    Please provide more details about your scenario in order to receive more to-the-point answer.

    Regards,
    Daniel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Ravi
    Ravi avatar
    13 posts
    Member since:
    Oct 2008

    Posted 22 Dec 2008 Link to this post

    i Get ClientId using the following url via


    http://www.telerik.com/community/code-library/aspnet-ajax/grid/accessing-server-controls-in-a-grid-template-on-the-client.aspx





     lot of thanks for your telerik webside and your products and you........
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017