Hi everyone
First of all, I'm aware of another existing thread that has the almost same title; I've read it, and it didn't solve my problem; therefore I decided to write a new thread.
My problem goes as follows:
I have an UpdatePanel placed in a page, which is defined as follows:
1.<asp:UpdatePanel ID="up" runat="server" Visible="false"> 2. <ContentTemplate> 3. <asp:Label runat="server" Visible="false" ID="myLabel"></asp:Label> 4. </ContentTemplate> 5.</asp:UpdatePanel>I need the Label and the Label's type to invoke some JavaScript with the ScriptManager.RegisterStartupScript method, which we will see later; both the UpdatePanel and Label are only needed for this purpose, and the RadComboBox is not placed in there!
The following is the JavaScript method I need to invoke using the ScriptManager.RegisterStartupScript:
1.function MyFunc(){ 2. var combo = $find("MyRadComboBox.ClientID"); 3. combo.get_text(); 4.}And the following is the RegisterStartupScript method I use in the code-behind file:
1.ScriptManager.RegisterStartupScript(myLabel, myLabel.GetType(), "MyKey", "MyFunc();", true);Everytime the JavaScript method gets invoked by the RegisterStartupScript method from the code-behind, I get the following error on the client-side:
Uncaught TypeError: Cannot call method 'get_text' of null
The RadComboBox can't be found on the client-side using $find in this special situation. If I try to access it from Chrome's JS Console using the $find method, I'll get the object, and the invocation of a method on it works perfectly.
What am I doing wrong here? How can I fix this? It's a pretty annoying little problem, and I hope somebody can point me to the right direction.
Thanks very much in advance guys!