Carmen

Carmen

  • NA
  • 11
  • 0

Retrieving Data values from ListView

Jul 27 2009 4:52 PM

This is my ListView
<
asp:ListView ID="ListView1" runat="server" >
<LayoutTemplate>
<table runat="server" id="itemTable">
<tr>
<th></th>
<th>Name 1</th>
<th>Name 2</th>
<th>Name 3</th>
<th>Name 4</th>
<th>Name 5</th>
</tr>
<tr runat="server" id="itemPlaceholder" ></tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td><asp:CheckBox ID="CheckBox1" runat="server" /></td>
<td><%# DataBinder.Eval(Container.DataItem, "name1") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "name2") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "name3") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "name4") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "name5") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
This is My code
protected
void Button1_Click(object sender, EventArgs e)
{
      for (int i = 0; i < ListView1.Items.Count; i++)
      {
         CheckBox chk = ListView1.Items[i].FindControl("CheckBox1") as CheckBox;
         if(chk.Checked == true)
      {
         ** Here I want to be able to get the value of 
            <td><%# DataBinder.Eval(Container.DataItem, "name1") %></td>
         From my ListView ItemTemplate**
      }
   }
}

Answers (1)