Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>create a Page class, let say, TemplateViewerPage</p> <p>TemplateViewerPage.cs</p> <pre><code>using System; using System.Web.UI; public partial class TemplateViewerPage : Page { protected override void OnLoad(EventArgs e) { // load your properties _subject = "test"; _messageBody = "body"; base.OnLoad(e); } // your property private string _subject; public string Subject { get { return _subject; } set { _subject = value; } } private string _messageBody; public string MessageBody { get { return _messageBody; } set { _messageBody = value; } } } </code></pre> <p>then you can create viewer for template A :</p> <p>ViewerA.aspx</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="false" Inherits="TemplateViewerPage" CodeFile="TemplateViewerPage.cs" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Subject&lt;/td&gt; &lt;td&gt; &lt;%= Subject %&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Message&lt;/td&gt; &lt;td&gt; &lt;%= MessageBody %&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and ViewerB, with same code behind (codefile=TemplateViewerPage.cs)</p> <p>ViewerB.aspx:</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="false" Inherits="TemplateViewerPage" CodeFile="TemplateViewerPage.cs" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;div class="subject"&gt; &lt;%= Subject %&gt; &lt;/div&gt; &lt;div class="message"&gt; &lt;%= MessageBody %&gt; &lt;/td&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload