There are two things I do not understand too well in this scenario
First, there is a javascript that is in this format
function Allocate()
{
this.Name = $("allocateName");
this.AddAllocation = $("addAllocation");
this.setCustom= $("setCustom");
}
... some other initializations here
Allocate.prototype.EnableAllocations = function() {
this.enableAllAlloactions();
this.setCustomAllocations();
}
This is just an example, so is this some kind of class in Javascript? this is in a file called Allocate.js.
My questions are the following:
If I was to call the EnableAllocations in a Page.ClientScript.RegisterClientScriptBlock(...); how would I do that?
You should instance the Allocate object, and call its EnableAllocations function.
So you can create a string with tha code and pass it using like this:
This method is deprecated. Use ClientScriptManager.RegisterClientScriptBlock Method instead (it depends on which version of the framework you’re using).
Finally, I don’t know which library you’re using, but the
$()comes from some library. So there’s a dependency on that library, and also onallocateName,addAllocationand so on.. whatever they’re.