I need the the .ASPX file to behave differently based on a conditional compilation symbol.
Let's say as an easy example:
<%@ Control Language="C#" AutoEventWireup="true" (...) %>
<% #ifdef DEBUG %>
<asp:SomeDebugControlHere runat="server"/>
.. well .. a LOT of code here
<% #else %>
<asp:SomeReleaseControlHere runat="server"/>
.. and a LOT of other code here
<% #endif %>
Later Edit: a few more clarifications. The problem is that the class SomeDebugControlHere is not even defined in the release build (it's way more complicated in real-life, but bear with this example). So in the page.aspx.designer.cs I need to get this in the debug build:
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.SomeDebugControlHere myControl
and this in the release build: (and never both)
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.SomeReleaseControlHere myControl
Obviously I need the mark-up in the ASPX file to be different, but I need the designer.cs file to be modified as well to incorporate the new objects/classes.
I'm just hoping somebody knows of a clever way of doing this either by some control inheritance, anything that would allow me to specify different control classes depending on compilation build settings.
Your if just needs a tweak, should be:
<% #if DEBUG %>
If you want it to behave like a set of C# code would.
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