Raise event when leaving Textbox

T

tshad

Is there a way to raise an event when a user exits a textbox?

I tried OnTextChanged and that doesn't seem to do it.

<asp:textbox id="email" TextMode="SingleLine" OnTextChanged="checkRecords"
Columns="45" runat="server" />

I need to load a dropdownlist after someone enters his email. There would
be no button to push. After the user enters his name and email it needs to
check a table to see if there are already any record and if so load the
dropdown to all the user to choose one.

Thanks,

Tom.
 
K

Ken Cox [Microsoft MVP]

Hi Tom,

Don't forget autopostback="True":

<asp:textbox id="email" TextMode="SingleLine"
OnTextChanged="checkRecords" Columns="45" runat="server"
autopostback="True" />

Public Sub checkRecords(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Write("Checking records here for " & email.Text)
End Sub

Ken
MVP [ASP.NET]
Toronto
 
T

tshad

Ken Cox said:
Hi Tom,

Don't forget autopostback="True":

I did forget that.

It worked.

I have a similar problem with the dropdownlist.

If I make a selection (which may be the one already showing), how can I jump
to function as he makes a choice?

I can use OnSelectedIndexChanged, as the index may not change.

Would I use autopostback here also? If so, what event should I use?

Thanks,

Tom.
<asp:textbox id="email" TextMode="SingleLine"
OnTextChanged="checkRecords" Columns="45" runat="server"
autopostback="True" />

Public Sub checkRecords(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Write("Checking records here for " & email.Text)
End Sub

Ken
MVP [ASP.NET]
Toronto

tshad said:
Is there a way to raise an event when a user exits a textbox?

I tried OnTextChanged and that doesn't seem to do it.

<asp:textbox id="email" TextMode="SingleLine"
OnTextChanged="checkRecords" Columns="45" runat="server" />

I need to load a dropdownlist after someone enters his email. There
would be no button to push. After the user enters his name and email it
needs to check a table to see if there are already any record and if so
load the dropdown to all the user to choose one.

Thanks,

Tom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top