Dhaval Shukla Dhaval Shukla - 2 months ago 7
ASP.NET (C#) Question

$find returning null

I have radGrid in

.ascx
page in which I want to find the control using
$find
but it returns a null to me. Below is my code which I am using to get the object (written in .ascx).

<script type="text/javascript">
$(function () {
var Rates_gridID = $find('<%= gridRates.ClientID %>');
alert(Rates_gridID);
});
</script>


Here, I am getting
Rates_gridID
as null in alert. Interesting thing which I noted is when I change the jQuery version to
1.2.6
from
1.6.4
I am getting
Rates_gridID
object. I have googled this a lot but not getting any solution. I think the problem is with
$(function()
.

Answer

You are using the incorrect syntax. Try

$("body").find('<%= gridRates.ClientID %>');
Comments