Hi Suddu,
Then you have the option of custom validator. Refering to the Questions link provided by you I have created customValidator which retains the same functionality.
<div>
<div id = "dvListView">
<asp:ListView ID="ListView1" runat="server" GroupItemCount="3" GroupPlaceholderID="groupPlaceHolder1"
ItemPlaceholderID="itemPlaceHolder1">
<LayoutTemplate>
<table>
<asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
</tr>
</GroupTemplate>
<ItemTemplate>
<td>
<table cellpadding="2" cellspacing="0" border="1" style="width: 200px; height: 100px;
border: dashed 2px #04AFEF; background-color: #B0E2F5">
<tr>
<td>
<asp:CheckBox ID="chk" runat="server" CssClass="ListView_CheckBox" Text='<%# Eval("Name") %>' />
</td>
</tr>
</table>
</td>
</ItemTemplate>
</asp:ListView>
</div>
<asp:Button ID="btn" runat="server" Text="Validate"/>
<asp:CustomValidator ErrorMessage="Please check atleast one checkbox." runat="server" ClientValidationFunction="Validate" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
function Validate(sender, args) {
args.IsValid = $("#dvListView input[type=checkbox]:checked").length > 0;
}
</script>
</div>
.CS
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id"), new DataColumn("Name"), new DataColumn("Country") });
dt.Rows.Add(1, "John Hammond", "United States");
dt.Rows.Add(2, "Mudassar Khan", "India");
dt.Rows.Add(3, "Suzanne Mathews", "France");
dt.Rows.Add(4, "Robert Schidner", "Russia");
ListView1.DataSource = dt;
ListView1.DataBind();
}
}
Thanks and Regards,
Rk_Hirpara