
I am using a page with several Telerik controls including RadWindow RadGrid etc. RadTextBox rad ToolTip
when I call txtBox.Focus from the server side where txtBox is a RadTextBox I get the error
Sys.ScriptLoadFailedException. The script /Script.Resource.Axd could not be loaded.
What is up?
If I don't call the Focus() method of the RadTextBox I do not get the javascript error.
5 Answers, 1 is accepted

I created a new radTextBox on the form, focus does work on the new one.
However, the first control that failed is on a div who is defined as:
<div runat="server" id="pnlMovement" style=" background: #E0E0FF;
position: absolute; width: 99%; height: 30px; left: 1px; top: 500px; z-index: 10;
border-color: Navy; border-style: solid; border-width: thin;">
What I do is I hide and reposition this div as needed.
The error happens to any RadTextBox on this div and not to any RadTextBox not on the div, therefore it appears that the div is the issue.
After even further study. The issue seems to be the postback. After a postback it happens.
Also please note that I am using a RadAjaxPanel for the entire form.
Could you paste your aspx and code-behind. How are you repositioning the div, are you taking it outside the RadAjaxPanel?
Thanks in advance.
Regards,Tsvetoslav
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.

<
httpHandlers>
...
<
add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
Since my project predates AJAXs and was not build from an ajax template it was missing
Thanks.

I've found two different situations that caused this error.
Visible=false
In the first scenario, I've found that it had to do with a Telerik controls Visibility being set to false and changing it to true in the code behind. The client-side javascript throws an error. Instead of using the Visible, I had to add an style attribute for display=none instead and then remove that style when the control is to be seen again. This implementation works around the client side issue.
pnlEdit.Style.Remove("display");
pnlLabel.Style.Add("display", "none");
and
pnlEdit.Style.Add("display", "none");
pnlLabel.Style.Remove("display")
Set Focus
A second scenario was when I was setting focus to a RadNumericTextBox (the type of rad control may not matter). I couldn't simply set focus to the control, I had to tell the panel in which the numeric text box was in to set control to the text box.
txtToFocus = item.FindControl("txtQuantityOnHand") as RadNumericTextBox;
pnlContent.FocusControl(txtToFocus);
//txToFocus.Focus(); //this way causes client side issues.
Thank you very much for sharing your findings and way to solve the error! This is much appreciated and your Telerik points were updated.
Best Regards,
Rumen
Progress Telerik