The OnInit method
(continued from
this page)
As you can see here the most important parts are that we must make sure our JavaScript file is included. Another
very important part is that we
register our control by calling the Manager.Instance.RegisterPage method. Without this method call our control will just be a "normal" WebControl and not a Gaja Ajax control!
A couple of other interesting parts is that we include the common Gaia JavaScrip files, for us that means builder.js, controls.js and dragdrop.js. (from ScripAculous)
In addition the
AddInclusionOfCommonFiles method will include the "fundamental" files which ALL Gaia Ajax Controls needs. Basically this ensures inclusion of the prototype.js, Control.js and the WebControl.js which are the JavaScript base classes in Gaia. (in addition to the prototype library)
In addition we toss away the existing WebControlProertyInjector object and creates a new since all changes done in it up till now are basically just the changes done while serializing to and from the .aspx file definitions.
Also the observant reader might have noticed some "funny parameter" to our include JavaScript method. The
last parameter of e.g. the
RegisterClientScriptInclude method is actually a
JavaScript type and this type ensures we have loaded the
complete JavaScript file before we try to use types from it. It is only used when we include JavaScript files in Ajax CallBacks! Basically it's a
safety hatch to ensure that he whole JavaScript file have been loaded before we try to execute code from within it!
Continue to the JavaScript file