title: How to call button click function in ascx
body: <p>I am trying to add a button to my <code>ascx</code> page and do some functionalities. But the button <code>OnClick</code> not firing. So, please advise me on how to access the button click method. Thank you</p>
  <p>ascx page:</p>
  <pre><code>&lt;asp:Button ID=&quot;btnEncryptNIN&quot; runat=&quot;server&quot; Text=&quot;Encrypt&quot; OnClick=&quot;btnEncryptNIN_Click&quot;/&gt;
  </code></pre>
  <p>ascx.cs:</p>
  <pre><code>        protected void Page_Load(object sender, EventArgs e)
          {
  
              if (Request.Url.ToString().Contains(&quot;printreportingchart.aspx&quot;))
              {
                  lblEmpNumber.Style.Add(&quot;display&quot;, &quot;none&quot;);
                  lblEmpNumber1.Style.Add(&quot;display&quot;, &quot;none&quot;);
                  //miniProfile.InnerText = &quot;&quot;;
  
              }
                  
          }          
          protected void btnEncryptNIN_Click(object sender, EventArgs e)
              {
                  string name = &quot;s&quot;;
              }
  </code></pre>