By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,432 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,432 IT Pros & Developers. It's quick & easy.

How to Check

P: n/a

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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.