title: Using UrlEncode in HyperLink Button in .NET and in Anchor Tag of HTML
body: <p>I am just trying to use UrlEncode in a Hyperlink which is in GridView and found it was not working. Then I tried to take the HyperLink as a separate control and tried with that. It is not giving Hyperlink to me, I mean it is not even clickable.</p>
  
  <p>While when I tried with simple Anchor tag, it is working. This is what I am using</p>
  
  <pre><code>    &lt;asp:HyperLink   ID="HyperLink2" runat="server" 
              NavigateUrl ='&lt;%= "~/Default.aspx?customer=" + "&amp;CompanyName=" + Server.UrlEncode("abc#")%&gt;' &gt; wc  
      &lt;/asp:HyperLink&gt;
  
  // While following is working
      &lt;a  title="asxd" href='&lt;%= "~/Default.aspx?customer=" + "&amp;CompanyName=" + Server.UrlEncode("abc#")%&gt;'&gt;wc
  &lt;/a&gt;
  </code></pre>
  
  <p>Still looking for the answer</p>