Reputation: 13
$(document).ready(function () {
$("#Button_Edit").click(function () {
var radio1 = $("#GridView_Customer_Project_List:radio[id^='RadioButton_Select']");
if (radio1.is(':checked') == true) {
alert("Selected");
}
if (radio1.is(':checked') == false) {
alert("Not selected");
}
});
});
in the above code always going to not selected alert message, i want to both validation
Upvotes: 0
Views: 1009
Reputation: 1105
I think you are not selecting the GridView properly.Try this:
var count=$('table[id*="GridView_Customer_Project_List"] input[type="radio"]:checked').length;
if (count > 0){
alert ('Selected');
}
else
alert('Not Selected');
Upvotes: 1
Reputation: 165
Try the following code
$(document).ready(function () {
$("#Button_Edit").click(function () {
var radio1 = $("#GridView_Customer_Project_List:radio[id^='RadioButton_Select']");
if (radio1.is(':checked') == true) {
alert("Selected");
}
else
{
if (radio1.is(':checked') == false) {
alert("Not selected");
}
}
});
});
Upvotes: 0