title: ASP.NET Changing Href depending on SQL-Query result
body: <p>here is my problem:</p>
  
  <ol>
  <li><p>I have a SQL-Query where i get a boolean as result if there is a result in the database or not</p>
  
  <pre><code>bool excists1;
  public bool Indikatoren
  {
      get
      {
           string ik = (string)GetScalar3("SELECT Data FROM Table WHERE Thing = condition)
           excists1 = ik != null ? true :false;
           return excists1;
      }
  }
  </code></pre></li>
  </ol>
  
  <p>This so far is working perfactly fine.</p>
  
  <ol start="2">
  <li><p>I have the HTML Block in my ASPX Page with the Button. Depending on the result of the Query (If Indikatoren is true or false) the href link has to change. Note that the "onlick" is only there with the JS Solution.</p>
  
  <pre><code>&lt;div class="col-6 py-3 px-3"&gt;
                  &lt;a class="btn btn-outline-secondary print-hidden-block" id="indi" runat="server" onclick="ChangeRef()" target="_blank" href="#"&gt;open&lt;/a&gt;
  </code></pre></li>
  <li><p>Now comes the real problem. I tried different Solutions, with C# and JavaScript. Neither of them is working and i always get redirected to the same page because the program only readys the standard href="#". I used alert in the JS Solution to show me the value of Indikatoren and it is indeed True.</p>
  
  <p>3.1 C# Solution</p>
  
  <pre><code>private void ChangeRef()
  {
  if (Indikatoren==true)
  {
      indi.HRef = "Link1";
  }
  else
  {
      indi.HRef = "Link2";
  }
  </code></pre>
  
  <p>3.2 JS Solution</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var JSindi = '&lt;%=Indikatoren%&gt;';
  function ChangeRef() {
      if (JSindi == true) {
          document.getElementById("indi").href="../SchulStat/SchoolDetailsView.aspx";
      }
  }
  alert(JSindi)
    &lt;/script&gt;
  </code></pre></li>
  </ol>
  
  <p>Since JSIndi is indeed True, i dont understand why the program always open href="#" and ignores both ways totaly.</p>
  
  <p>Please help me it's driving me crazy :) Am i doing something wrong in my code or is there an even better way to change the href in my case?</p>