Javascript function to get values from C# fields or properties in ASP.Net
<p>I’m new to JavaScript. Basically I want a function in JavaScript which will show me an email preview in a web browser. I’ve stored email’s template, body and contents.</p>

<p><strong>SQL:</strong> </p>

<pre><code>SELECT Name, template, body, contents FROM Email
WHERE EmailID = 1
</code></pre>

<p><strong>C#:</strong>
  I have a LinkButton (ID="lnkViewDoc") on asp.net page and the code behind is:</p>

<pre><code>lnkViewDoc.Attributes.Add("onclick", "return preview_email();");
</code></pre>

<p><strong>JavaScript:</strong>
I need a function please which will pick values from the class fields and show it in a web browser. thanks</p>

<pre><code>function preview_email() {

  ..................
  window.open() //Something
}
</code></pre>

<p><strong>Contents:</strong></p>

<pre><code>&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&gt;      
    &lt;title&gt;&lt;/title&gt;  
&lt;/head&gt;  
&lt;body&gt;
  &lt;center&gt;
      ..................
  &lt;/center&gt;
&lt;/body&gt;
</code></pre>

<p><strong>Body:</strong></p>

<pre><code>&lt;div style="text-align: left"&gt;   Dear .......,
    ...........................................
&lt;/div&gt;  
&lt;div style="text-align: left"&gt;   &amp;nbsp;&lt;/div&gt;  
</code></pre>
