title: ASP.NET/C# trying to use page_load method on a form with #A on end of web address through link
body: <p>I am needing to use the same form for displaying multiple things and I realize that when I add links like:</p>
  
  <pre><code>    &lt;a href="#A"&gt;A&lt;/a&gt;
  </code></pre>
  
  <p>it has the same form and web address, but with a #A at the end of the address.I thought I could use this for displaying multiple things on the same form. My idea is to have C# code in the page_load method to detect what the web address is and use a conatins method for the url string and detect if there is #A to change the content of the form. Here is an example:</p>
  
  <p>C# code:</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
           string url = HttpContext.Current.Request.Url.AbsoluteUri;
           if(url.Contains("#A"))
           {
                div1.Visible = false; //content 1
                div2.visible = true;  //content 2
           }
      }
  </code></pre>
  
  <p>asp.net code:</p>
  
  <pre><code>    &lt;a href="#A"&gt;A&lt;/a&gt;
      &lt;div ID="div1" runat="server"&gt;
          content 1
      &lt;/div&gt;
      &lt;div ID="div2" runat="server"&gt;
          content 2
      &lt;/div&gt;
  </code></pre>
  
  <p>I have tried to put the Page_Load method in a script tag, but still didn't work. I guess since the url is different the cs code is not valid? I know it goes through the page_load method once, before I click on the link. Also I do use a method that gives me the controls of div1 and div2, so that is not the problem. I thank everyone in advance for your help! Also if my way is not the way to do the job then please tell me any way possible to achieve what I am trying to do.</p>
  
  <p>edit: I can't use a button to replace a link... maybe a asp:hyperlink?</p>