title: How to get TextBox value on page load?
body: <p>I have developed a web application using ASP.NET and C#.NET. My client wants the page to hold the data even if the page refreshes. So, I am trying to read the <code>Textbox</code> value and putting into the session but in page load event I find the <code>TextBox</code> as empty.
  Here is what I am trying:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      Session["name"] = txtName.Text.Trim();
  }
  </code></pre>
  
  <p>I have also tried with this:</p>
  
  <pre><code>if (!IsPostBack)
  {
      Session["name"] = txtName.Text.Trim();
  }
  </code></pre>
  
  <p>But still the same.</p>