|
You sure can and it's dead simple to register dependencies in code too.
I'd suggest if you ever get stumped like that you just download the source code and have a look at the demo/test web project in there as it has samples for pretty much everything that you can do with CDF.
In WebForms you can use this syntax:
ClientDependencyLoader.GetInstance(http).RegisterDependency("Content.css", "Styles", ClientDependencyType.Css);
In MVC there's an extension method called 'GetLoader' on the ViewContext, ControllerContext and HttpContextBase, so you can use the following syntax (for example if you wanted to dynamically register a dependency from an HtmlHelper):
html.ViewContext.GetLoader().RegisterDependency(priority, resourceUrl, ClientDependencyType.Javascript);
Hope that helps!
|