Apr 16, 2013, 2:30 PM
Injecting javascript before PartialViewResult script executed?
Hi,
I have a partial view which is requested & loaded into a modal window.
Following is the action method which generates the partial view:
The executing script looks like this:
How can i inject my own custom code somewhere in this generated javascript block?
My purpose is to dynamically load some external javascript files which are needed in the partial view.
I dont want to statically include script references in every main view i use this partial view. I want to gain some kind of automatization by loading js files when they are needed.
I have a partial view which is requested & loaded into a modal window.
Following is the action method which generates the partial view:
public Ext.Net.MVC.PartialViewResult GetPartialView()
{
return new Ext.Net.MVC.PartialViewResult { Model = ...., ViewName = "MyPartialView" };
}
After GetPartialView() is called via ajax request, necessary scripts are generated and sent back to the client.The executing script looks like this:
{script:"Ext.net.ResourceMgr.registerIcon([\"TextListBullets\",\"Add\"]);Ext.onReady(function(){Ext.create(\"Ext.window.Window\",{height:400,hidden..... bla bla}
Question:How can i inject my own custom code somewhere in this generated javascript block?
My purpose is to dynamically load some external javascript files which are needed in the partial view.
I dont want to statically include script references in every main view i use this partial view. I want to gain some kind of automatization by loading js files when they are needed.