Hi all,
How to validates TextBox using javascript in ASP.NET ?
Loading
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.
Prabhu RajaPosted Oct 19, 2011, 1:39 PM
Satyapriya NayakPosted Oct 19, 2011, 10:17 AM
Try this for blank validation
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Thanks
If this post helps you mark it as answer
kap solutionsPosted Oct 19, 2011, 8:44 AM
Javeed M ShaikhPosted Oct 18, 2011, 1:13 PM
What do you mean by validate, is it just textbox cannot be blank or something else? Following is the code which checks if the textbox is empty in javsacript:
var x = document.getElementById("TextBoxID").value;
if(x.length == 0)
{
// your code here if textbox is blank
}
Please do not forget to mark "Accepted Answer".