How to validate textbox and dropdownlist using jquery?

Posted by Hariinakoti under jQuery on 4/23/2013 | Points: 10 | Views : 23856 | Status : [Member] | Replies : 3
Hi All,
How to validate textbox and dropdownlist using jquery?

Thanks&Regards
Hari

Thanks & Regards
Hari



Responses

Posted by: Satyapriyanayak on: 4/23/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Validate_DropdownList_Using_JQuery._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>

<script src="jquery/jquery-1.9.1.js" type="text/javascript"></script>

<script type="text/javascript" language="javascript">
$(document).ready(function() {
$('#btnSubmit').click(function() {
if ($("#ddlName").val()>0) {
return true;
}
else {
alert('Please select Name')
return false;
}
})
});

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td> <b>Select Name:</b></td>
<td>
<asp:DropDownList ID="ddlName" runat="server">
<asp:ListItem Text="Select" Value="0" />
<asp:ListItem Text="Raj" Value="1" />
<asp:ListItem Text="Ravi" Value="2" />
<asp:ListItem Text="Rahul" Value="3" />
</asp:DropDownList>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnSubmit" Text="Submit" runat="server" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>


If this post helps you mark it as answer
Thanks

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 4/23/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
validate textbox using jquery

http://www.dotnetcurry.com/ShowArticle.aspx?ID=310
http://www.c-sharpcorner.com/Blogs/5004/
http://jetlogs.org/2007/09/14/jquery-textbox-validation-and-the-blur-event/
http://encosia.com/using-jquery-validation-with-asp-net-webforms/
http://www.codeproject.com/Articles/43772/Generic-Code-of-Validating-Fields-with-Jquery

If this post helps you mark it as answer
Thanks

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimi1289 on: 4/26/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>


<script>
$('#Button').click(function() {

if ($("#TextBox").val() == "") { alert("Please enter a value and then proceed."); $('#TextBox').focus(); return false; }

});
</script>


Please mark as answer, if it was of any help to you.

Also check for more JQuery and Asp.Net stuff. http://www.encodedna.com/category/jquery/

Hariinakoti, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response