This Way:
HTML:
<form id="form1" runat="server">
<div>
<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
<table border="0" cellpadding="1">
<tr style="background-color: #E5E5FE">
<th align="left">
CustomerID
</th>
<th align="left">
Name
</th>
<th align="left">
City
</th>
</tr>
<tr runat="server" id="itemPlaceholder" />
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="CheckBox1" Text='<%# Eval("CustomerID") %>' runat="server" />
</td>
<td>
<asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
</td>
<td>
<asp:Label ID="lblCity" runat="server" Text='<%# Eval("City") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:Button ID="Button1" Text="Search" OnClick="Save" runat="server" />
</div>
</form>
C#:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindList();
}
}
private void BindList()
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3]{
new DataColumn("CustomerId", typeof(int)),
new DataColumn("Name", typeof(string)),
new DataColumn("City", typeof(string))});
dt.Rows.Add(1, "Jake", "Madrid");
dt.Rows.Add(2, "John", "London");
dt.Rows.Add(3, "Micheal", "Lisbon");
dt.Rows.Add(3, "Azim", "Mumbai");
this.ListView1.DataSource = dt;
this.ListView1.DataBind();
}
protected void Save(object sender, EventArgs e)
{
int count = 0;
Button btn = sender as Button;
foreach (ListViewItem item in this.ListView1.Items)
{
if ((item.FindControl("CheckBox1") as CheckBox).Checked == true)
{
count++;
}
}
if (count == 0)
{
string message = "Please check at least one CheckBox";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(message);
sb.Append("')};");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString());
}
}
Output

Thank You.