Alexan
Alexan

Reputation: 8637

replacing ScriptManager by ToolkitScriptManager

I know if I'm using AjaxControlToolkit I need to replace:

<asp:ScriptManager

by

<ajaxToolkit:ToolkitScriptManager

But do I need to replace ScriptManager in code behind too:

ScriptManager.RegisterStartupScript

by

ToolkitScriptManager.RegisterStartupScript

I got warning there: access to a static member of a type via a derived type

UPDATE:

okay, maybe RegisterStartupScript belongs to ScriptManager and ToolkitScriptManager derived from ScriptManager? In this case it doesn't make sense to replace it for RegisterStartupScript?

Upvotes: 2

Views: 3945

Answers (1)

Brian Mains
Brian Mains

Reputation: 50728

I've used ScriptManager with the AJAX control toolkit before, no problem. I was using an older version, so maybe that requirement came later, but it may not be a requirement at all; it's possible it adds additional conveniences for you. You're getting the warning because of the inheritance there, since ToolkitScriptManager inherits from ScriptManager, that would be why. It's probably OK to use ToolScriptManager for that...

As long as it works, that's what matters most :-)

Upvotes: 3

Related Questions