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

[Solved] Error in accessing objects in javascript in Content Page

3 Answers 118 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marco Miccini
Top achievements
Rank 1
Marco Miccini asked on 29 Aug 2009, 05:46 PM
Hello,
I've a master page (with <head> without runat=server) and a content page where I've put a telerik RadTextBox control (named "RadTextBox1").
I'm trying to access this object  in javascript with the following code:
 - var tb=$find("<%=RadTextBox.ID%>");

but when executing this line I get the following error at runtime: Impossible to modify Controls entirely because the control contains code blocks .

I'd the same problem with a normal page (not in the master/content paradigm) when putting the javascript function definition in the <head> segment but shifting it in the body area the error disappeared.

Now I've tried to put the javascript at the beginning and at the end of the <ContentPage> tag but nothing changes.

Any help?
Thanks.

3 Answers, 1 is accepted

Sort by
0
Marco Miccini
Top achievements
Rank 1
answered on 29 Aug 2009, 05:48 PM
Pardon, the correct line of js code was:
- var tb=$find("<%=RadTextBox1.ID%>")
0
Marco Miccini
Top achievements
Rank 1
answered on 29 Aug 2009, 05:54 PM
argh....pardon again... also my <head> has some problems....
Here is the code:
- var tb=$find("<%= RadTextBox1.ClientID %>");
0
Sebastian
Telerik team
answered on 31 Aug 2009, 10:15 AM
Hello Marco,

Does the error you get disappear when you wrap your javascript code inside a RadCodeBlock instance? Further information on this subject can be found in the relevant paragraph of this documentation topic.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Marco Miccini
Top achievements
Rank 1
Answers by
Marco Miccini
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or