title: Post values in ASP .Net hiddenfield when using masterpages
body: <p>In my ASP .Net Form application I need to post some data using hiddenfields.</p>
  
  <ol>
  <li>Need to set the values dynamically in page load in the code behind file</li>
  <li>Have to use the hidden fileds in a web form which using a masterpage.</li>
  </ol>
  
  <p>I have to add <code>runat="server"</code> attribute as need to access the field in code behind file to assign value dynamically..... There the problem begins.</p>
  
  <p>eg:</p>
  
  <pre><code>&lt;input type="hidden" runat="server" id="uname" value="abc" /&gt;
  </code></pre>
  
  <p><strong>converts to following by ASP .Net in run time</strong></p>
  
  <pre><code> &lt;input name="ctl00$content$uname" type="hidden" id="content_uname" value="abc" /&gt;
  </code></pre>
  
  <p>So a diffrent filed <code>name="ctl00$content$uname"</code> gets posted.</p>
  
  <p>I tried adding <code>ClientIDMode="Static"</code> but still a different named field creates by ASP .Net in run time for <code>name</code> field as following</p>
  
  <pre><code>&lt;asp:HiddenField ID="uname" runat="server" Value="abc" ClientIDMode="Static" /&gt;
  </code></pre>
  
  <p><strong>Converts to following by asp .net</strong></p>
  
  <pre><code>&lt;input type="hidden" name="ctl00$content$uname" id="uname" value="abc" /&gt;
  </code></pre>
  
  <p>If somebody can guide me of how to post values using hiddenfields by assingning values in run time in code beghind in a masterpage environment in ASP .Net, would be really grateful. Thanks...</p>