467,926 Members | 1,460 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

How to Check


In my webform i have 2 textbox

controls and one button control.
in 1st textbox control i'll enter

email id when it lost its focus i've

tocheck whether the entered email id

exist in database or not, if exists

it has to dispay message that email

id already exist
and i want to set focus to that text box.

see the below code
Private Sub txtEmail_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtEmail.TextChanged

Dim i As Byte

Dim cmd As New OleDbCommand

cmd.Connection = MyConn

cmd.CommandText = "Select count(*) from QA_UserType where Email_Id='" &
txtEmail.Text & "'"

i = cmd.ExecuteScalar()

If i <> 0 Then

Response.Write(txtEmail.Text & " already exist")

txtEmail.Text = ""

// how to set focus to this text box. //

End If

End Sub

Private Sub txtEmail_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtEmail.TextChanged

Dim i As Byte

Dim cmd As New OleDbCommand

cmd.Connection = MyConn

cmd.CommandText = "Select count(*) from QA_UserType where Email_Id='" &
txtEmail.Text & "'"

i = cmd.ExecuteScalar()

If i <> 0 Then

Response.Write(txtEmail.Text & " already exist")

txtEmail.Text = ""

End If

End Sub

when am running my application am

getting that message after clicking

on submit button. but what i want is
Hi,
it has to check before clicking on

submit button.
I set postback property of text box to true.

thanx in advance
yoshitha

Nov 19 '05 #1
  • viewed: 1539
Share:
2 Replies
Just setting the autopostback property of the textbox should actually work.
This results in a postback as soon as the value of the textbox is changed and
the textbox loses focus.

Kind regards,
Nikander & Margriet Bruggeman

"Yoshitha" wrote:

In my webform i have 2 textbox

controls and one button control.
in 1st textbox control i'll enter

email id when it lost its focus i've

tocheck whether the entered email id

exist in database or not, if exists

it has to dispay message that email

id already exist
and i want to set focus to that text box.

see the below code
Private Sub txtEmail_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtEmail.TextChanged

Dim i As Byte

Dim cmd As New OleDbCommand

cmd.Connection = MyConn

cmd.CommandText = "Select count(*) from QA_UserType where Email_Id='" &
txtEmail.Text & "'"

i = cmd.ExecuteScalar()

If i <> 0 Then

Response.Write(txtEmail.Text & " already exist")

txtEmail.Text = ""

// how to set focus to this text box. //

End If

End Sub

Private Sub txtEmail_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txtEmail.TextChanged

Dim i As Byte

Dim cmd As New OleDbCommand

cmd.Connection = MyConn

cmd.CommandText = "Select count(*) from QA_UserType where Email_Id='" &
txtEmail.Text & "'"

i = cmd.ExecuteScalar()

If i <> 0 Then

Response.Write(txtEmail.Text & " already exist")

txtEmail.Text = ""

End If

End Sub

when am running my application am

getting that message after clicking

on submit button. but what i want is
Hi,
it has to check before clicking on

submit button.
I set postback property of text box to true.

thanx in advance
yoshitha

Nov 19 '05 #2
hi
i've one more problem

i've to enter email id in text box so when am entering the email id the
textchanged event is firing.
but when i enter first charcter in the text box , the email ids statrs with
that character are displaying in the text box, so when i select that email
id, it is displaying in that text box but it not firing the textchaged event
of text box and also if i obseve the length of this text box it is
displaying 0 .
why this is happening with my application.
can u tell me
thanx in advance
yoshitha
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Craig Bailey | last post: by
2 posts views Thread by Askari | last post: by
2 posts views Thread by Edward | last post: by
7 posts views Thread by Tony Johnson | last post: by
1 post views Thread by scprosportsman | last post: by
2 posts views Thread by Chris Davoli | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.