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

Telerik Rad Grid is not able to access ClientID.

5 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Devendra
Top achievements
Rank 1
Devendra asked on 10 May 2012, 11:19 AM
Hi,

I have telerik Rad Grid Control. I want disabled row to be checked even if someone check/uncheck select all functionality. So I have written below Jquery code to handle it.

$(document).ready(function () {
        $("#SelectColumnSelectCheckBox").click(function () {
            var checked = this.checked;                      
            if (checked == false) {
                $("#ctl00_MainContent_gridRules_ctl00 tbody tr").each(function () {
                    if ($(this).attr('disabled') == "disabled") {
                        $(this).find("input").attr('checked', 'checked');
                    }
                });
            }
        });
    });

I want to change the hardcoded value of grid (ctl00_MainContent_gridRules_ctl00) and Select all checkbox (SelectColumnSelectCheckBox) to clientID.

I have tried <%=Radgrid.ClientID%> but that does not work.

Does anyone know how to get the clientID of the telerik RAD grid?

Please give me reply sooner as this is urgent for me.

Thanks in advance.

Regards,
Devendra.

5 Answers, 1 is accepted

Sort by
0
RR SoftSol
Top achievements
Rank 1
answered on 10 May 2012, 09:09 PM
Hi there,

From the telerik documentation i found this, and in practice it did work for me. Radgrid1 is the server side ID of your radgrid object.

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
var grid = $find("<%=RadGrid1.ClientID %>");
//execute some logic here 
</telerik:RadCodeBlock>

Good luck, i hope this will work for you.
0
Devendra
Top achievements
Rank 1
answered on 11 May 2012, 08:14 AM
Hi,

I also tried your solution but it is failing in var grid = $find("<%=RadGrid1.ClientID %>");. seems like $find is not a function in my jquery 1.6.2 version. so the above solution is not a good option.

Regards,
Devendra.
0
RR SoftSol
Top achievements
Rank 1
answered on 11 May 2012, 09:04 AM
hey,

$find is not from jquery, but comes with ajax. Though i am not sure from which library it comes from, i think it comes with the framework.
One thing you could check just to be sure, is if you have a scriptmanager on your page?
But i don't think radgrid would work at all without one.

3.Add a ScriptManager control on top of the page in which you are going to add any RadControl.
<asp:ScriptManager ID="ScriptManager1" runat="server" />

Also, did you try to debug your application and let it break on the javascript line it fails? Then you can see in more detail what the problem is. You can even see if $find is declared or not. Or simply add an alert($find); before the line and then run the application could work as well i think.

Good luck, perhaps you are on the right track now to find the problem :).
0
Raksha
Top achievements
Rank 1
answered on 15 Nov 2016, 10:58 AM
i see something here: http://www.techjunkieblog.com/2013/09/telerik-why-find-method-is-not-working.html
0
Marin Bratanov
Telerik team
answered on 15 Nov 2016, 12:52 PM

Hi all,

The following article explains the details on getting client-side references and the events you should use: http://docs.telerik.com/devtools/aspnet-ajax/general-information/get-client-side-reference.

Regards,

Marin Bratanov
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Devendra
Top achievements
Rank 1
Answers by
RR SoftSol
Top achievements
Rank 1
Devendra
Top achievements
Rank 1
Raksha
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or