title: Add row of data to ListView VB.Net
body: <p>I'm, trying to add a row of data to a five columned list view. I have an issue with passing an array of strings into a <code>ListViewItem</code> as it does not accept the array of data. I have little experience using these views so if someone could point out what I'm doing wrong, that would be great.</p>
  
  <p>My listview is <code>lvChanges</code></p>
  
  <hr>
  
  <p>I have the following setup, is my current implementation utilizing ListView correctly? </p>
  
  <p>Column 1 to 4: String</p>
  
  <p>Column 5: LinkButton, CommandName="ApproveChange" - which is handled in code, however, I'm not sure how to pass an identifier for the row in <em>CommandArgument="?"</em>. I've seen many example use <code>&lt;%# Eval('someKey') %&gt;</code> <strong>How does that work?</strong> How can I pass the key? Do I need a read only property? So long as my code behind page has objects, can the attributes be directly "Eval'd"? </p>
  
  <hr>
  
  <p>I'm trying to add items with error on the line: <em>"Value of type '1-dimentional array of String' cannot be converted to 'System.Web.UI.WebControls.ListViewItemType"</em></p>
  
  <pre><code>For i As Integer = 0 To addressList.Count
          Dim item As ListViewItem
          Dim data(5) As String
          data(0) = "Adress Change"
          data(1) = stakeholderList(i).ToString
          data(2) = stakeholderList(i).Address.ToString
          data(3) = addressList(i).ToString
          data(4) = "need the link button here!"
          item = New ListViewItem(data)    ' &lt;-- Error
          lvChanges.Items.Add(item)
      Next
  </code></pre>
  
  <p>The data above, should go into five <code>&lt;td&gt;</code> tags in the <code>ItemTemplate</code>, as below</p>
  
  <pre><code>&lt;asp:ListView ID="lvChanges" runat="server"&gt;
          &lt;LayoutTemplate&gt;
              &lt;table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server"&gt;
              &lt;tr id="Tr1" runat="server" style="background-color: #dfdbdf"&gt;
                  &lt;th runat="server"&gt;&lt;%= Type %&gt;&lt;/th&gt;
                  &lt;th runat="server"&gt;&lt;%= Requester %&gt;&lt;/th&gt;
                  &lt;th runat="server"&gt;&lt;%= OldAddress%&gt;&lt;/th&gt;
                  &lt;th runat="server"&gt;&lt;%= NewAddress%&gt;&lt;/th&gt;
                  &lt;th runat="server"&gt;&lt;%= Decision%&gt;&lt;/th&gt;
              &lt;/tr&gt;
              &lt;tr runat="server" id="itemPlaceholder" /&gt;
            &lt;/table&gt;
          &lt;/LayoutTemplate&gt;
          &lt;ItemTemplate&gt;
              &lt;tr runat="server" &gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;asp:LinkButton runat="server" 
                      ID="btnApprove" 
                      Text="Approve" 
                      CommandName="ApproveChange"
                      CommandArgument='&lt;%# Eval("?") %&gt;'/&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:ListView&gt;
  </code></pre>
  
  <p>For the <code>CommandArgument</code>, how can it so that row knows the stakeholder ID in order to complete the functionality of this piece.</p>