You must Sign In to post a response.

Textbox empty validation

hello experts help me , i want coding to find textbox empty i.e if i press button without entering any value in textbox an error msg should to be display. i'm using standard textbox and button controls .

platform details: asp.net 3.5 ,code behind:vb


Comments

Author: Maruthi Panyam24 Mar 2010 Member Level: Gold   Points : 2

Hi,

check on click of button, if textbox.text is equal to "" then display messge

Author: britto24 Mar 2010 Member Level: Silver   Points : 2

tell me briefly plz

Author: chandrashekar25 Mar 2010 Member Level: Silver   Points : 2

place a button and textbox on the UI .
double click the button

and write the following code .


--- vb.net ------------
If (TextBox1.Text = String.Empty) Then
MessageBox.Show("TextBox is empty")
End If
----------------------
import system.IO


hope u got it

Author: Dharmaraj Nagarajan25 Mar 2010 Member Level: Gold   Points : 2

Hi,

While performing validation there are two types of validations available. 1) Client side validation 2) Server side validation. Client side validation reduces time and increased efficiency of the program. client validation can be done using javascript.



if (document.formname.fieldname.value.length == 0) {
alert("Please fill out your name.\n");
return false;
}

Author: Arun K25 Mar 2010 Member Level: Gold   Points : 2

you can use javascript for it

Author: Chakrahari Muralidhar Bhattu25 Mar 2010 Member Level: Silver   Points : 2

u can use client side validation using javasript or server side write code in .cs file or use validation controls required filed validator

Author: Naga Shankar25 Mar 2010 Member Level: Gold   Points : 2

use validation controls required filed validator

Author: Rajapandian25 Mar 2010 Member Level: Gold   Points : 2

Use OnClientClick event of button.



Author: naveen gupta25 Mar 2010 Member Level: Silver   Points : 2

hello

You Can use the Required field validator control.
just set the control to validate propety of the validation control to the textboxid and error mesaage to what you want for error message.

And Set the textbox and the button's Validation group to same name Lets say 'a'

Regards

Naveen Gupta