Hello sir,
I am trying to validate on gridview textbox and dropdownlist if the checkbox is checked.
I tried by javascript and jquery the validation applied but the postback happed.
How to validate this on server side.
jquery code:
$(document).ready(function () {
$(document).on('click', '#btnSave', function () {
var trs = $('[id*=gv_Toppers]').closest('tr:not(":has(th)")');
$(trs).each(function () {
if ($(this).find('[id*=chkToppers]')[0].checked) {
var marks = $(this).find("[id*=txtMarks]").val().trim();
var rank = $(this).find("[id*=ddlRank]").val();
if (marks == "" || rank == "0") {
alert("Required");
return false;
}
}
});
});
});
source code:
AutoGenerateColumns="false" DataKeyNames="pk_student_m" OnRowDataBound="gv_Toppers_RowDataBound">
<%-- --%>
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nakul ChaudhariPosted Dec 7, 2017, 1:11 PM