I'm writing a module which needs a TON of settings, including a dozen fonts. So I wrote a separate ascx control (fontPicker) which I want to include in multiple locations on the settings page, so I can have just twelve fontpicker controls instead of 12 X (bold, italilc, size, name... you get the idea).
It works just fine in the development environment, but when I precompile, package and distribute to test, I started getting an error about not being able to load the global_asax file or one of its dependencies after loading the custom module (when I took it back out, the site loaded fine).
Then I thought that what I'm doing really looks a lot like the DNN controls - say for instance the labelControl. The distinction with that control seems to be that the codebehind class is located well separate from the .ascx file - that is to say, it's in the Library portion of the directory tree and is referenced by the ascx control located in the Website portion of the tree. I assume this means that it is compiled into the DotNetNuke.dll.
So I tried something similar, moving my code file into the module's folder in the App_Code directory. I also removed the "CodeFile" setting in the ascx file, removed the "partial" class qualifier, and declared the necessary UI variables (checkboxes, a textbox and a dropdown) in the code file, trying to mimic what was done in the labelControl.
Well, at least it compiles... but when I try to run it (even in the development environment!), I get a null reference exception when I set the first property (in this case, doing a "txtFontDescription.Attributes.Add("someAttribute", somestring)". Stepping through with the debugger, the control is definitely a nothing. yet the labelControl gets away with referencing these things (eg, "lblLabel.Text = Value" in the Text property setter).
The only twist here is that I'm a vb programmer finding my way in c#. The variable declaration is straightforward, I think: protected System.Web.UI.WebControls.TextBox txtFontDescription;
Any help, thoughts or insights would be appreciated. Thanks.