title: How to pass values from parent.aspx page to user control?
body: <p>I have the following setup in my application and I'm having some difficulties passing values my user control.</p>
  
  <p><strong>ASPX</strong></p>
  
  <pre><code>&lt;% 
         var posts = this.getPosts();
  
         foreach (var post in posts)
         { %&gt;
              &lt;asp:TextBox runat="server" Text="&lt;%: post.post_id %&gt;" /&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p><strong>CS</strong></p>
  
  <pre><code>DataClassesDataContext db = new DataClassesDataContext();
  
      public Post[] getPosts(int offset = 0, int lenght = 10)
      {
          var resultSet = db.Posts.OrderBy(x =&gt; x.date).Skip(offset).Take(lenght).ToArray();
  
          return resultSet;
      }
  
      protected void Page_Load(object sender, EventArgs e)
      {
          DataBind();
      }
  </code></pre>
  
  <p>The TextBox value on page load is "&lt;% post.post_id %>". I even tried using the &lt;%# post.post_id %> tag but that gives an error - "The name 'post' does not exist in the current context".</p>
  
  <p>Any suggestions?</p>