Using a ScriptManager in razor?
Asked Answered
L

2

5

Must be a simple question, but I cannot for the life of me figure out how to include a script manager in my view. <asp:ScriptManager /> doesn't work. Anyone know?

Limelight answered 19/1, 2011 at 20:28 Comment(0)
W
13

ScriptManager is a webforms specific construct, so if you are using MVC, you won't (and shouldn't) be able to use it. You can look at http://mvcscriptmanager.codeplex.com/ if you want something that ports some of the features of the scriptmanager to MVC.

Writ answered 19/1, 2011 at 20:34 Comment(0)
S
2

I ran into a similar situation upgrading a project. For "simple-ish" WCF Ajax services, I was able to get this work by adding:

<script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
<script type="text/javascript" src="@Url.Content("~/Services/SampleService.svc/jsdebug")"></script>

and then create my service object the old fashion way:

var dataService = new SampleService();
dataService.doBar(fooCallback,fooErrorMethod,null);

I haven't tested this is extensively, but Hey, isn't that why the word "kludge" became an official developer term.

Sailmaker answered 7/12, 2011 at 18:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.