title: Passing CommandArguement to LinkButton from variable
body: <p>I have seen many resources on SO that say that I can use following syntax to pass value to CommandArguement of `LinkButton'</p>
  
  <pre><code>&lt;%forearch(var comment in Comments){%&gt;
  &lt;asp:LinkButton ID="del" CommandArguement='&lt;%= comment.CommentId%&gt;' onCommand="delete_click" Text="Delete"/&gt;
  
  &lt;%}%&gt;
  </code></pre>
  
  <p>But when I write this in my ascx file and click on the link the value passed to command argument is <code>"&lt;%=comment.CommentId%&gt;"</code> instead of commentId itself. Please guide what am I doing wrong?</p>
  
  <p><strong>Edit 1</strong><br>
  based on answers and comments, I have moved to use repeater instead of foreach and plain code. Here is the code I have come up with</p>
  
  <pre><code>&lt;asp:Repeater ID="commRepeater" SelectMethod="GetPageComments" runat="server"&gt;
          &lt;ItemTemplate&gt;
              &lt;p&gt;
                  &lt;%#Eval("Comment") %&gt; 
                  &lt;%if(Page.User.Identity.IsAuthenticated &amp;&amp; Page.User.Identity.GetUserId() == Eval("UserId")){ %&gt;
                  &lt;span&gt;
                      &lt;asp:LinkButton  Text="Edit" runat="server" ID="EditLink" CommandArgument='&lt;%#Eval("CommentId")%&gt;' OnClick="Update_Comment" /&gt;&amp;nbsp;&amp;nbsp;
                      &lt;asp:LinkButton  Text="Delete" runat="server" ID="DeleteLink" CommandArgument='&lt;%#Eval("CommentId")%&gt;' OnClientClick="if (!confirm('Are you sure you want delete?')) return false;" OnCommand="Delete_Comment"  /&gt;
                  &lt;/span&gt;
                  &lt;%} %&gt;
  
              &lt;/p&gt;
          &lt;/ItemTemplate&gt;        &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>you can see that I am trying to show the edit and delete links if user is logged in and his Id matches with user who commented but it tells me that I can on use <code>Eval</code> in databound controls. how would I hide/show edit/delete links conditionally within repeater</p>