473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

asp:TextBox - TextChange Event (Enter Key Does Not Work)

PD
The TextChanged event is not being called when I hit the "Enter" key.
Yet it does for the "Tab" key. I set a break point in the Page_Load
event and the TextChanged event and none of these get called when I
hit the 'Enter' key. After typing in letters in the textbox, if I hit
the 'Tab' key or click outside the text box with my mouse, the event
fires.

Here's the code:

<form id="frmArticle" name="frmArticle" method="post" runat="server">
.......
.......
<asp:textbox id="txtSearchCriteria"
OnTextChanged="txtSearchCriteria_TextChanged" runat="server"
AutoPostBack=True></asp:textbox></input>&nbsp;&nbsp;
.......
.......
</form>

Here's the procedure code:

Sub txtSearchCriteria_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Try
FindArticles()
blnSearch = True
Catch ex As Exception
Throw ex
End Try
End Sub
Any suggestions would be greatly appreciated!
Pat
Nov 18 '05 #1
5 22991
TextChanged is fired when the control loses focus...hitting enter doesn't
change focus..hitting tab moves the cursor to the next item, thus it loses
focus...

karl

"PD" <pd*****@commonwealth.com> wrote in message
news:9d**************************@posting.google.c om...
The TextChanged event is not being called when I hit the "Enter" key.
Yet it does for the "Tab" key. I set a break point in the Page_Load
event and the TextChanged event and none of these get called when I
hit the 'Enter' key. After typing in letters in the textbox, if I hit
the 'Tab' key or click outside the text box with my mouse, the event
fires.

Here's the code:

<form id="frmArticle" name="frmArticle" method="post" runat="server">
......
......
<asp:textbox id="txtSearchCriteria"
OnTextChanged="txtSearchCriteria_TextChanged" runat="server"
AutoPostBack=True></asp:textbox></input>&nbsp;&nbsp;
......
......
</form>

Here's the procedure code:

Sub txtSearchCriteria_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Try
FindArticles()
blnSearch = True
Catch ex As Exception
Throw ex
End Try
End Sub
Any suggestions would be greatly appreciated!
Pat

Nov 18 '05 #2
asp.net form doesnot automatically submit on key press enter key.
change event is fired on onLostFocus and causes the focus to move from
current control to the next control then it fires the changed event then.

hth

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"PD" <pd*****@commonwealth.com> wrote in message
news:9d**************************@posting.google.c om...
The TextChanged event is not being called when I hit the "Enter" key.
Yet it does for the "Tab" key. I set a break point in the Page_Load
event and the TextChanged event and none of these get called when I
hit the 'Enter' key. After typing in letters in the textbox, if I hit
the 'Tab' key or click outside the text box with my mouse, the event
fires.

Here's the code:

<form id="frmArticle" name="frmArticle" method="post" runat="server">
......
......
<asp:textbox id="txtSearchCriteria"
OnTextChanged="txtSearchCriteria_TextChanged" runat="server"
AutoPostBack=True></asp:textbox></input>&nbsp;&nbsp;
......
......
</form>

Here's the procedure code:

Sub txtSearchCriteria_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Try
FindArticles()
blnSearch = True
Catch ex As Exception
Throw ex
End Try
End Sub
Any suggestions would be greatly appreciated!
Pat

Nov 18 '05 #3
PD
So how could I get the enter key to kick off an event on the code
behind? The function I'm trying to get to work is a search page. When
user's type in a search filter and hit 'Enter' I would like that to
trigger the code that returns the result data to the page. Thoughts?
Thanks again!

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message news:<OY**************@TK2MSFTNGP15.phx.gbl>...
asp.net form doesnot automatically submit on key press enter key.
change event is fired on onLostFocus and causes the focus to move from
current control to the next control then it fires the changed event then.

hth

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"PD" <pd*****@commonwealth.com> wrote in message
news:9d**************************@posting.google.c om...
The TextChanged event is not being called when I hit the "Enter" key.
Yet it does for the "Tab" key. I set a break point in the Page_Load
event and the TextChanged event and none of these get called when I
hit the 'Enter' key. After typing in letters in the textbox, if I hit
the 'Tab' key or click outside the text box with my mouse, the event
fires.

Here's the code:

<form id="frmArticle" name="frmArticle" method="post" runat="server">
......
......
<asp:textbox id="txtSearchCriteria"
OnTextChanged="txtSearchCriteria_TextChanged" runat="server"
AutoPostBack=True></asp:textbox></input>&nbsp;&nbsp;
......
......
</form>

Here's the procedure code:

Sub txtSearchCriteria_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Try
FindArticles()
blnSearch = True
Catch ex As Exception
Throw ex
End Try
End Sub
Any suggestions would be greatly appreciated!
Pat

Nov 18 '05 #4
PD
Found a solution... Added onkeypress="return(submitForm());" to the
asp:text control. SubmitForm code..

function submitForm()
{
if (event.keyCode == 13)
{
frmArticle.submit();
}
}
</script>

Then when return key is pressed, the form submits. Appears to work
fine so far.

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message news:<OY**************@TK2MSFTNGP15.phx.gbl>...
asp.net form doesnot automatically submit on key press enter key.
change event is fired on onLostFocus and causes the focus to move from
current control to the next control then it fires the changed event then.

hth

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"PD" <pd*****@commonwealth.com> wrote in message
news:9d**************************@posting.google.c om...
The TextChanged event is not being called when I hit the "Enter" key.
Yet it does for the "Tab" key. I set a break point in the Page_Load
event and the TextChanged event and none of these get called when I
hit the 'Enter' key. After typing in letters in the textbox, if I hit
the 'Tab' key or click outside the text box with my mouse, the event
fires.

Here's the code:

<form id="frmArticle" name="frmArticle" method="post" runat="server">
......
......
<asp:textbox id="txtSearchCriteria"
OnTextChanged="txtSearchCriteria_TextChanged" runat="server"
AutoPostBack=True></asp:textbox></input>&nbsp;&nbsp;
......
......
</form>

Here's the procedure code:

Sub txtSearchCriteria_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Try
FindArticles()
blnSearch = True
Catch ex As Exception
Throw ex
End Try
End Sub
Any suggestions would be greatly appreciated!
Pat

Nov 18 '05 #5
well you could manually trap the enter key using javascript and call same
clientside code as the onLostFocus

but its not a clean way to do it.. and i just disable enter key.. ie do
nothing if enter key is pressed.

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"PD" <pd*****@commonwealth.com> wrote in message
news:9d**************************@posting.google.c om...
Found a solution... Added onkeypress="return(submitForm());" to the
asp:text control. SubmitForm code..

function submitForm()
{
if (event.keyCode == 13)
{
frmArticle.submit();
}
}
</script>

Then when return key is pressed, the form submits. Appears to work
fine so far.

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message

news:<OY**************@TK2MSFTNGP15.phx.gbl>...
asp.net form doesnot automatically submit on key press enter key.
change event is fired on onLostFocus and causes the focus to move from
current control to the next control then it fires the changed event then.
hth

--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
"PD" <pd*****@commonwealth.com> wrote in message
news:9d**************************@posting.google.c om...
The TextChanged event is not being called when I hit the "Enter" key.
Yet it does for the "Tab" key. I set a break point in the Page_Load
event and the TextChanged event and none of these get called when I
hit the 'Enter' key. After typing in letters in the textbox, if I hit
the 'Tab' key or click outside the text box with my mouse, the event
fires.

Here's the code:

<form id="frmArticle" name="frmArticle" method="post" runat="server">
......
......
<asp:textbox id="txtSearchCriteria"
OnTextChanged="txtSearchCriteria_TextChanged" runat="server"
AutoPostBack=True></asp:textbox></input>&nbsp;&nbsp;
......
......
</form>

Here's the procedure code:

Sub txtSearchCriteria_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Try
FindArticles()
blnSearch = True
Catch ex As Exception
Throw ex
End Try
End Sub
Any suggestions would be greatly appreciated!
Pat

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alex | last post by:
I am a newbie to ASP.NET... What I was trying to do... but yet to succeed in... I am building a customer info database... and on default, I want to display the customer's basic information in...
7
by: Jan Hoffman | last post by:
hi @all I have the following element in an ascx-file: <asp:TextBox id="name" runat="server">name</asp:TextBox> The textbox belongs to an application of a telefonebook. I want that if I...
5
by: Alex D. | last post by:
Does any body knows how to link an asp:textbox to an asp:imagebutton, both inside a User Control in asp.net 2 beta 2? So when a user enter some text in the textbox and press the "Enter" key the...
1
by: Imran Aziz | last post by:
Hello All, I have an option of search on my web page coded as under <p>Search Bookmarks: <asp:TextBox ID="txtSearch" runat="server" class="texta" ></asp:TextBox><asp:Button ID="btnSearch"...
11
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and...
6
by: John Smith | last post by:
I have my <asp:TextBox> inside one of DataGrid's columns. I haven't set AutoPostBack=True. When I hit the ENTER button, my page "refreshes" (I belive that PostBack was performed - however not...
0
by: sunilthk | last post by:
Hi All, I want to know how the TextBox control knows that it's data has been changed, since it is able to detect changes and fires TextChange event if the data in the TextBox has been changed. I...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
0
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.