TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bhavleen Singh
NA
203
5k
GridView validation using JQuery
Jul 1 2019 1:37 AM
Here I've 2 columns containing checkboxes, for selecting that I'm using JQuery mention as follows
$("[id*=Bankcb]").live("click", function () {
var chkHeader = $(this);
var grid = $(this).closest("table");
$("input[id*=BankApprovecb]", grid).each(function () {
if (chkHeader.is(":checked")) {
$(this).attr("checked", "checked");
$("td", $(this).closest("tr")).addClass("selected");
} else {
$(this).removeAttr("checked");
$("td", $(this).closest("tr")).removeClass("selected");
}
});
});
$("[id*=BankApprovecb]").live("click", function () {
var grid = $(this).closest("table");
var chkHeader = $("[id*=Bankcb]", grid);
if (!$(this).is(":checked")) {
$("td", $(this).closest("tr")).removeClass("selected");
chkHeader.removeAttr("checked");
} else {
$("td", $(this).closest("tr")).addClass("selected");
if ($("[id*=BankApprovecb]", grid).length == $("[id*=BankApprovecb]:checked", grid).length) {
chkHeader.attr("checked", "checked");
}
}
});
$("[id*=TReDScb]").live("click", function () {
var chkHeader = $(this);
var grid = $(this).closest("table");
$("input[id*=TReDS_Statuscb]", grid).each(function () {
if (chkHeader.is(":checked")) {
$(this).attr("checked", "checked");
$("td", $(this).closest("tr")).addClass("selected");
} else {
$(this).removeAttr("checked");
$("td", $(this).closest("tr")).removeClass("selected");
}
});
});
$("[id*=TReDS_Statuscb]").live("click", function () {
var grid = $(this).closest("table");
var chkHeader = $("[id*=TReDScb]", grid);
if (!$(this).is(":checked")) {
$("td", $(this).closest("tr")).removeClass("selected");
chkHeader.removeAttr("checked");
} else {
$("td", $(this).closest("tr")).addClass("selected");
if ($("[id*=TReDS_Statuscb]", grid).length == $("[id*=TReDS_Statuscb]:checked", grid).length) {
chkHeader.attr("checked", "checked");
}
}
});
but I've 1 validation, that if columns of 1st checkboxes is checked then user couldn't check the checkboxes given on 2nd column followed by alert message, I'm not able to get exact logic to do this. Can Anyone Help me on this.
Reply
Answers (
2
)
how to call AJAX in hover effect
jquery .Plzz Help me