title: Display variable in textbox
body: <p>In my ASP.NET page I have a search box that is currently working as expected. What I would like to do is leave the searched value in that textbox after searching (the search opens a new page, though I'm retaining the search value from querystring). I can confirm the variable is being retained correctly by using the value <code>&lt;%= search%&gt;</code> in my aspx, however when I try to show that in my textbox nothing displays. I have searched dozens of forum posts and the nearest I can tell is that I need to databind this textbox. I'm not sure where my mistake is, but this is the closest I have come up with:</p>
  
  <pre><code>&lt;asp:TextBox ID="SearchTextBox" runat="server" Text='&lt;%# search %&gt;'&gt;&lt;/asp:TextBox&gt;
  Search: &lt;%=search %&gt;
  </code></pre>
  
  <p>With the code behind </p>
  
  <pre><code>public string search;
  
  protected void Page_Load(object sender, EventArgs e)
  {
      search = Request.QueryString["search"];
      SearchTextBox.Text = search;
      Page.DataBind();
  }
  </code></pre>