Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
104 views

Hi everyone,
I'm having problems with $find and getElementById. In my page $find doesn't find the objects while getElementById finds them but then the client-side API functions are not executed (error message: "splitter2.get_height is not a function").

$find always returns NULL, both on the RadSplitter and RadGrid.

To understand I also isolated the affected code in a new page, same problem. This is the code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>

    <div>
        <telerik:RadSplitter ID="RadSplitter1" runat="server" SplitBarsSize="2" Width="100%" >
            <telerik:RadPane ID="LeftPane" runat="server" >
                <telerik:RadGrid ID="RadGrid1" runat="server"></telerik:RadGrid>
            </telerik:RadPane>
            <telerik:RadPane ID="RightPane" runat="server" >
            </telerik:RadPane>
        </telerik:RadSplitter>
    </div>
    <script type="text/javascript">
        var Alt = window.innerHeight;
        var Larg = window.innerWidth;
        var splitter = $find('<%= RadSplitter1.ClientID %>');
        alert(splitter);

        var grid = $find('<%= RadGrid1.ClientID %>');
        alert(grid);

        var splitter2 = document.getElementById('<%= RadSplitter1.ClientID %>');
        alert(splitter2);
        alert(splitter2.get_height());
        splitter2.set_height(800);

    </script>
    </form>
</body>
</html>

 

Thanks for your help

 

Rumen
Telerik team
 answered on 28 Aug 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?