Hi all,
How to validates TextBox using javascript in ASP.NET ?
How to validates TextBox using javascript
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Javeed M ShaikhRank #839 · 2.7K reputationPosted Oct 18, 2011, 9:13 AM EDT
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".
kap solutions3 reputationPosted Oct 19, 2011, 4:44 AM EDT
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 19, 2011, 6:17 AM EDT
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
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 19, 2011, 9:39 AM EDT