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
manish kedar
NA
229
11.5k
validate the gridview control
Dec 13 2017 5:43 AM
Hello Sir,
I have a girdview, in that i have textbox and dropdownlist.
I want to validate that control on client side with checkbox if checkbox is checked then check the textbox is empty and dropdownlist also. and i have only one button in bottom.
I done that validation but whenever checkbox is checked and textbox not empty then also alert msg is showing..and also how to get client id of particular row....
Please help me.
the code is :--
on button click....
function
Validate() {
var
chkBoxList = document.getElementById(
'<%=gv_Toppers.ClientID %>'
);
var
chkBoxCount = chkBoxList.getElementsByTagName(
"input"
);
for
(
var
i = 0; i <chkBoxCount.length; i++) {
if
(chkBoxCount[i].checked) {
var
txtMarks = document.getElementById(
'txtMarks'
);
var
ddlRank = document.getElementById(
'ddlRank'
);
if
(txtMarks==
""
|| txtMarks==
null
)
{
alert(
"Please Enter Student Marks!!!"
);
return
false
;
}
if
(ddlRank.value ==
"0"
|| ddlRank.value ==
"Select Rank"
) {
alert(
"Please Select Student Rank!!!"
);
return
false
;
}
}
}
}
Attachment:
myQ.rar
Reply
Answers (
1
)
Remove or hide .aspx extention form url
How to Pass javascript variable to controller (c#) MVC