title: ASP.NET and the classic HTML form
body: <p>I am implementing a standard payment system, which sends some information to 3rd part form. I've a checkout object which stores all my shopping information: ID, products bought, price - you name it.</p>
  
  <p>People are transfered to an ASPX page which has an implementation as seen below.</p>
  
  <p><strong>Currently I have the following problem</strong>:</p>
  
  <p>The values send on the inputs which has the runat="server" is 0. Therefore I get an error. However, in the OnPreInit event in the code behind, i set the values of amount, accepturl and orderid. I can see the hidden fields get the correct information when the page is loaded - but when the form is fired (which apparently happens before the OnPreInit event), it is still 0.</p>
  
  <p>How do I solve this problem? Basically I need to use an HTML form which opens a popup window (which HAS to show on page load), where I have to set the hidden fields. Should be quite simple, but after I've used hours on this I would really appreciate some help.</p>
  
  <p>Currently my implementation is like this:</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="BetalingMedKort.aspx.cs" Inherits="BetalingMedKort" %&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;script type="text/javascript" src="http://www.epay.dk/js/standardwindow.js"&gt;&lt;/script&gt; 
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  
  
  &lt;body onload="open_ePay_window()"&gt;
  
      &lt;form action="SomeUrl" runat="server" method="post" name="ePay" target="ePay_window" id="ePay"&gt;
  &lt;input type="hidden" name="merchantnumber" value="MyStaticMerchantNumber" /&gt; 
  &lt;input type="hidden" name="language" value="1" /&gt; 
  &lt;input type="hidden" name="currency" value="208" /&gt; 
  &lt;input type="hidden" name="amount" id="amountField" runat="server" /&gt; 
  &lt;input type="hidden" name="accepturl" id="acceptUrlField" runat="server" /&gt; 
  &lt;input type="hidden" name="orderid" id="orderIdField" runat="server"  /&gt;
  &lt;input type="hidden" name="declineurl" value="SomeUrl" /&gt;
  
  &lt;/form&gt; 
  
  
      &lt;div&gt;
          If the ePay Payment Window does not open automatically please click on the button below to open it.
      &lt;br /&gt;&lt;br /&gt;
  Notice! If you are using a pop-up blocker, you must hold down the CTRL key as you click the button.
  &lt;br /&gt;&lt;br /&gt;
  &lt;input type="button" value="Open the ePay Payment Window" onClick="open_ePay_window()"&gt; 
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks so much...</p>