troubleshooting Question

ASP.Net 2 textbox autopostback not working for ontextchanged event.

Avatar of questinc
questinc asked on
.NET ProgrammingASP.NET
4 Comments1 Solution5115 ViewsLast Modified:
I am having problems getting a text box to post back from tabbing off of the field.  I thought you should be able to use the ontextchanged event with autopostback set to true to cause it to post back and submit the page.  I need it to work with tab because the information is entered by a barcode scanner so having the users hit enter each time will make it more difficult on them.  Here is the code I am using:

<script runat="Server">
Sub Page_Load(Sender As Object, E As EventArgs)
end sub
sub Submit_click(s As Object, e As EventArgs)
   Server.Transfer("CASscaninput2.aspx")
end sub
</script>
<script language="VBScript">
function setfocus()
    CAS.ConsumerID.focus
end function
</script>
<html>
<title>Client Attendance System</title>

<meta name="Microsoft Theme" content="none, default">
<body onload="setfocus()">
<form name="CAS" id="CAS" runat="Server">
<p align="left"><font size="5" face="Gill Sans MT"><b>

<asp:ValidationSummary ID="ValidationSummary1"
   HeaderText=""
   ShowMessageBox="True"
   ShowSummary="False"
   Runat="Server" />
   
<b>Client ID:</b>
<asp:TextBox
   id="ConsumerID"
   columns="13"
   Runat="Server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
   ControlToValidate="ConsumerID"
   Display="Dynamic"
   Text="<b>*</b>"
   ErrorMessage="Please enter a valid value for the 'ConsumerID' field."
   Runat="Server" />
&nbsp;
<b>Time:</b>
<asp:TextBox
   id="Time"
   AutoPostBack="true"
   OnTextChanged="Submit_click"
   columns="10"
   Runat="Server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
   ControlToValidate="Time"
   Display="Dynamic"
   Text="<b>*</b>"
   ErrorMessage="Please enter a valid value for the 'Time' field."
   Runat="Server" />
<br />
</font>
<br>
<P align=left>
<asp:Button
   ID="Submit"
   Text="Submit"
   onClick="Submit_Click"
   Runat="Server" />
</form>
</html>
ASKER CERTIFIED SOLUTION
PHD

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros