I know this isn't possible; I'm looking for a workaround really. I have a bunch of classes in a .dll file that all inherit the same abstract HtmlGenerator class. All these do is generate content HTML for parts of the page, based on certain user settings. I also have JavascriptGenerator and CssGenerator, which do pretty much the same thing. Much like a UserControl ;)
All these controls are either rendered on the page or can be loaded via AJAX calls.
The problem I'm having is that the strings contain a lot of " and it's getting a bit ugly to put in strings. It'd be nice if I could get them into .ascx files.
I understand that ascx files can't be placed in a class library because the references to other files, such as images, aren't going to work. But all my files are generated HTML based on certain profile data. There aren't any images and there isn't any actions taking place, such as editing values in a database.
You can inherit UserControl and override the Render method in a class library, but is there a way of getting an ascx file to be compiled in a class library? Or is there a decent enough workaround? Perhaps I should put the HTML in the resources file?
Give this a shot:
C:\Program Files\Microsoft Visual Studio 8\Web\WebNewFileItems\CSharp (assuming a default installation of VS.NET).C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjectItems\CSharpItems.vsdir and paste the contents of the clipboard underneath the existing text.C:\Program Files\Microsoft Visual Studio 8\Web\WebNewFileItems\CSharp (excluding CSharpItems.vsdir) into the folder C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjectItems.Here's a post from Scott Guthrie that might help too:
http://webproject.scottgu.com/CSharp/UserControls/UserControls.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With