title: asp.net linkbutton onclientclick and postback
body: <p>I'm experiencing some weird behaviour when using a ASP.NET LinkButton with a OnClientClick-property.</p>
  
  <p><strong>ASPX</strong></p>
  
  <pre><code>&lt;asp:DropDownList ID="test" runat="server" AutoPostBack="true"&gt;
      &lt;asp:ListItem&gt;test1&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;test2&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;test3&lt;/asp:ListItem&gt;
  &lt;/asp:DropDownList&gt;
  
  &lt;asp:LinkButton CssClass="button" ID="btnDeleteGroup" runat="server"&gt;
      &lt;img src="cross.png" alt="delete-group" width="16" height="16" /&gt;
      &lt;span&gt;&lt;asp:Literal ID="lblDeleteGroup" runat="server" Text="Delete" /&gt;&lt;/span&gt;
   &lt;/asp:LinkButton&gt;
  </code></pre>
  
  <p><strong>Code-behind</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      btnDeleteGroup.OnClientClick = "return confirmAction('delete?');";
  }
  </code></pre>
  
  <p>Without the OnClientClick, everything is fine.
  With the OnClientClick, my LinkButton dissappears when a postback occurs (using the DropDownList).</p>
  
  <p>In <a href="https://stackoverflow.com/questions/584747/postback-issue-in-asp-net">another topic</a>, I've found a solution to set EnableViewState to false.
  But the application I'm writing is multilingual so with EnableViewState set to "false", I'm also losing my translation.</p>
  
  <pre><code>if ( !Page.IsPostBack ) {
      // translate all form elements
      TranslationUI();
  }
  </code></pre>
  
  <p>I rather not call this method outside the !Page.IsPostBack method because the TranslationUI-method() translates the form elements based on a database.</p>