title: Pass parameters to a user control - asp.net
body: <p>I have this user control:</p>
  
  <pre><code>&lt;user:RatingStars runat="server" product="&lt;%= getProductId() %&gt;" category="&lt;%= getCategoryId() %&gt;"&gt;&lt;/user:RatingStars&gt;
  </code></pre>
  
  <p>You can see that I fill in the product and category by calling two methods:</p>
  
  <pre><code>public string getProductId()
  {
      return productId.ToString();
  }
  
  public string getCategoryId()
  {
      return categoryId.ToString();
  }
  </code></pre>
  
  <p>I do not understand why, in the user control, when I take the data received (product and category) it gives me "&lt;%= getProductId() %>" instead of giving the id received from that method...</p>
  
  <p>Any help would be kindly appreciated...</p>
  
  <p><strong>Edit</strong>: Solved with: product='&lt;%# getProductId() %>'</p>
  
  <p><strong>Last problem</strong>: in the user control I have this:</p>
  
  <pre><code> public string productId;
   public string product
  {
      get
      {
          return productId;
      }
      set
      {
          productId = value;
      }
  }
  </code></pre>
  
  <p>So, I expect that the productId is set up ok in the user control.
  Unfortunately it is null when I try to use it...</p>
  
  <p>Is there anything I wrote that's incorrect?</p>