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

$find function does not work when used in ScriptManager

1 Answer 92 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
f
Top achievements
Rank 1
f asked on 29 Sep 2008, 03:51 AM
$0$0I have some problems with the $find $0$0Here is the contents of my .aspx file:$0$0<form id="form1" runat="server">$0$0        <asp:ScriptManager ID="ScriptManager1" runat="server" />$0$0 <telerik:RadComboBox ID="RadComboBox1" runat="server"></telerik:RadComboBox>$0$0 <script type="text/javascript"> $0$0 alert($find("RadComboBox1"));$0$0 </script>$0$0</form>$0$0my question:$0$0 alert return null,why?$0$0$0$0$0

1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 29 Sep 2008, 07:49 AM
Hi.

ASP.NET Ajax controls are not immediately initialized. This is the reason why $find will  return null.

You can use the pageLoad function where $find will return valid object:

function pageLoad()
{
     var combo = $find("<%= RadComboBox1.ClientID %>");
    alert(combo.get_text());
}

For more info about the pageLoad function and the client-side life-cycle in ASP.NET Ajax you can check the following article: http://www.asp.net/AJAX/Documentation/Live/overview/AJAXClientEvents.aspx

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
f
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or