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

Getting ClientID for a GridTemplateColumn Item

4 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 29 Sep 2008, 08:36 PM
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.

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Sep 2008, 08:10 AM
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.
0
Ravi
Top achievements
Rank 2
answered on 20 Dec 2008, 01:11 PM
i try this one but now also its not working
0
Daniel
Telerik team
answered on 20 Dec 2008, 01:21 PM
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.
0
Ravi
Top achievements
Rank 2
answered on 22 Dec 2008, 10:49 AM
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........
Tags
Grid
Asked by
Sintayehu
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ravi
Top achievements
Rank 2
Daniel
Telerik team
Share this question
or