Hello,
I have a RadTreeView that has nodes that use NodeExpandMode.ServerSide and I need to have the web page focus on the selected node after post back. I found the following code from these forums to do that:
Unfortunately, this project was made in Visual Studio 2005 which only has the .NET version of 2.0 which doesn't have the ScriptManager class.
I was wondering if RadScriptManager would be able to provide this functionality, and if so, could I be provided with an example on how to do this?
Thanks,
Matt
I have a RadTreeView that has nodes that use NodeExpandMode.ServerSide and I need to have the web page focus on the selected node after post back. I found the following code from these forums to do that:
ScriptManager.RegisterStartupScript(
this
, GetType(), ClientID,
string
.Format(
"Sys.Application.add_load(function(){{$find('{0}').get_element().focus();}}, 0);"
, AppTreeView.ClientID),
true
);
Unfortunately, this project was made in Visual Studio 2005 which only has the .NET version of 2.0 which doesn't have the ScriptManager class.
I was wondering if RadScriptManager would be able to provide this functionality, and if so, could I be provided with an example on how to do this?
Thanks,
Matt
10 Answers, 1 is accepted
0
Hi Matt,
Here is an example how you could achieve it with the RadScriptManager.
Regards,
Peter Filipov
Telerik
Here is an example how you could achieve it with the RadScriptManager.
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadScriptManager.RegisterStartupScript(Page, Page.GetType(),
"1"
,
"Sys.Application.add_load(function(){{alert('success');}}, 0);"
,
true
);
}
Regards,
Peter Filipov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0

Matt
Top achievements
Rank 1
answered on 10 Jun 2013, 07:41 PM
I've tried your solution however it doesn't work and I get these errors in the browser:
1. ASP.NET Ajax client-side framework failed to load.
2. 'Sys' is undefined.
I read that "'Sys' is undefined" could be due to the script manager not being declared in the .aspx file, but it is:
Thanks,
Matt
1. ASP.NET Ajax client-side framework failed to load.
2. 'Sys' is undefined.
I read that "'Sys' is undefined" could be due to the script manager not being declared in the .aspx file, but it is:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="tWebUI" %>
<
tWebUI:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
tWebUI:RadScriptManager
>
Thanks,
Matt
0
Hi Matt,
It is really strange that the ajax framework is not loaded. Could you please test the attached page at you side. Which version of our controls are you using?
Regards,
Peter Filipov
Telerik
It is really strange that the ajax framework is not loaded. Could you please test the attached page at you side. Which version of our controls are you using?
Regards,
Peter Filipov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0

Matt
Top achievements
Rank 1
answered on 12 Jun 2013, 06:25 PM
I'm using version 2013.1.403.35 of Telerik.Web.UI. I moved some things around and now I'm getting the following:
Unable to cast object of type 'System.Web.Configuration.ScriptingProfileServiceSection' to type 'System.Web.Configuration.ScriptingProfileServiceSection'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingProfileServiceSection' to type 'System.Web.Configuration.ScriptingProfileServiceSection'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Unable to cast object of type 'System.Web.Configuration.ScriptingProfileServiceSection' to type 'System.Web.Configuration.ScriptingProfileServiceSection'.]
System.Web.Configuration.ScriptingProfileServiceSection.GetConfigurationSection() +41
System.Web.ApplicationServices.ApplicationServiceHelper.EnsureProfileConfigLoaded() +47
System.Web.UI.ProfileServiceManager.GenerateInitializationScript(StringBuilder& sb, HttpContext context, ScriptManager scriptManager, String serviceUrl, ArrayList loadedProperties) +79
System.Web.UI.ProfileServiceManager.ConfigureProfileService(StringBuilder& sb, HttpContext context, ScriptManager scriptManager, List`1 proxies) +530
System.Web.UI.ScriptManager.ConfigureApplicationServices() +38
System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +290
System.Web.UI.ScriptManager.RegisterScripts() +386
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +113
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +8722194
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1029
0

Matt
Top achievements
Rank 1
answered on 12 Jun 2013, 06:42 PM
Well I fixed the above but I'm back to my original errors...
0
Hello Matt,
Could you clarify that you tested the sample page from my previous post and it is not working properly at you side. In case that everything is working properly could you please send me a live URL or setup a runnable sample based on the provided page that reproduces the problem and send it back for a local test.
Regards,
Peter Filipov
Telerik
Could you clarify that you tested the sample page from my previous post and it is not working properly at you side. In case that everything is working properly could you please send me a live URL or setup a runnable sample based on the provided page that reproduces the problem and send it back for a local test.
Regards,
Peter Filipov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0

Matt
Top achievements
Rank 1
answered on 27 Sep 2018, 08:24 PM
This works but I need it to wait until an action has occurred.... like clicking a single RadButton. How do I get it to wait until after that postback is complete?
0

Matt
Top achievements
Rank 1
answered on 27 Sep 2018, 08:30 PM
Nevermind, just add it after the actions in the job completes... long day....
0

Michael
Top achievements
Rank 1
answered on 01 Aug 2019, 09:08 AM
Hello Matt,
I am still having problems,
I am using <Telerik:RadAjaxManager> to stop the page jumping, <Telerik:RadScriptManage ID=“xxx” runat=“Server”> for the javascripts
I am going to rebuild the page step-by-step to find the problem as in a scratch project it seems to work, if this doesn’t work I will send you a copy. If I may
Regards,
Michael
0
Hи Michael,
It would be very useful to provide a sample runnable project along with instructions of how to replicate the problem and the error that you get.
If you want to disable the subsequent clicks with RadButton, please set its SingleClick="true" property as shown in this demo.
Regards,
Rumen
Progress Telerik
It would be very useful to provide a sample runnable project along with instructions of how to replicate the problem and the error that you get.
If you want to disable the subsequent clicks with RadButton, please set its SingleClick="true" property as shown in this demo.
Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.