title: ListView add image button with CommandName, Visible, CommandArgument dynamically by calling Eval()
body: <p>Attached desire output (Record(s)))
  right now i can add multiple links to Records column but cannot add muliple image button  with command name and command arguments
  <a href="https://i.stack.imgur.com/BkMiB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BkMiB.jpg" alt="enter image description here"></a>
  I tried to create image button dynamically by calling GetRecordLinks(Eval("Records"))` from code behind, below is my code</p>
  
  <pre><code>&lt;asp:ListView ID="Student" runat="server" OnItemCommand="Student_ItemCommand" OnItemDeleting="Student_ItemDeleting" OnItemDataBound="Student_OnItemDataBound"&gt;
          &lt;LayoutTemplate&gt;
              &lt;table class="DataGrid"&gt;
                  &lt;tr class="HeaderRow"&gt;                                               
                      &lt;td style="width: 150px;"&gt;Name&lt;/td&gt;
                      &lt;td style="width: 200px;"&gt;Class(s)&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Sex&lt;/td&gt;
                      &lt;td style="width: 200px;"&gt;Recordss&lt;/td&gt;
                       &lt;td style="width: 150px;"&gt;Status&lt;/td&gt;
                      &lt;td style="width: 30px; text-align: center;"&gt;Activate/Delete&lt;/td&gt;                                                
                  &lt;/tr&gt;
                  &lt;asp:PlaceHolder ID="itemPlaceholder" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
              &lt;/table&gt;
          &lt;/LayoutTemplate&gt;
          &lt;ItemTemplate&gt;
              &lt;tr&gt;                    
                  &lt;td&gt;
                      &lt;b&gt;&lt;%# Eval("StudentLastName") %&gt;, &lt;%# Eval("StudentFirstName") %&gt; &lt;%# Eval("StudentMiddleName") %&gt;&lt;/b&gt;                        
                  &lt;/td&gt;
                  &lt;td&gt;                        
                      &lt;%# JoinStringList(Eval("class")) %&gt;
                  &lt;/td&gt;
                  &lt;td&gt; &lt;%# Eval("sex") %&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;%# GetRecordLinks(Eval("Records")) %&gt;                        
                  &lt;/td&gt;                  
                  &lt;td&gt;
                      &lt;%# Eval("StatusID").ToString()=="0"?"Inactive":"Active" %&gt;
                  &lt;/td&gt;
                  &lt;td style="text-align: center;"&gt;                        
  
                     &lt;asp:ImageButton ImageUrl="img/Refresh.png" ID="StudentActive"  runat="server" CommandName="Active" Visible='&lt;%#Eval("StatusID").ToString()=="0"?true:false%&gt;' CommandArgument='&lt;%# Eval("StudentGUID") %&gt;' /&gt;                                                                
                      &lt;asp:ImageButton ImageUrl="img/delete.png" ID="StudentDelete" runat="server" CommandName="Delete" Visible='&lt;%#Eval("StatusID").ToString()=="0"?false:true%&gt;' CommandArgument='&lt;%# Eval("StudentGUID") %&gt;' /&gt;                                                
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:ListView&gt;
  </code></pre>
  
  <p><code>GetRecordLinks</code> method below </p>
  
  <p>I want to append asp:ImageButton with <code>CommandName</code> ,<code>Visible</code>,<code>CommandArgument</code> for each record of student.
  for eaxmple if student A have 5 records each five record in a cell, should have 5 imagebutton with iteamcommand so that i can delete or activate the record depend on use wish.</p>
  
  <pre><code>public string GetRecordLinks(object obj)
      {
          if (obj != null)
          {
              List&lt;AppointmentDoc&gt; docs = (List&lt;AppointmentDoc&gt;)obj;
              StringBuilder sb = new StringBuilder();                                              
              foreach (AppointmentDoc rec in docs)
              {                    
                  sb.Append("&lt;a target='_blank' href=\"result.ashx?uuid=" + rec.UUID.ToString() + "\"&gt;" + rec.Name.Replace("student", "").Trim() + " (" + rec.SignedBy + ")" + (rec.staffSigned ? "*" : "") + "&lt;/a&gt;&lt;br/&gt;");
              }
              return sb.ToString();
          }
          return "";
   }
  </code></pre>
  
  <hr>
  
  <p>hope understand my question
  let me know if any queries</p>
  
  <p>thanks</p>