473,387 Members | 1,624 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,387 software developers and data experts.

TextBox AutoPostBack=false question (bug?)

Hello,

I have a strange yet very simple problem with the asp.net Textbox web control.

On an empty asp.net page, add a single asp:TextBox control with
Autopostback=false with nothing else on the page.

according to the doc, hitting Enter while the TextBox has focus should do
nothing since Autopostback=false. The problem i have is that it posts the
form (that is, it ignores the Autopostback=false).

Now if i add another textbox to the page, i no longer experience the
problem(???????????).

Is my framework (2.0) corrupted or is anyone else able to reproduce that bug?

Thanks for any help

Renaud

=============
sample page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<html>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" ID="txt" AutoPostBack="false"
></asp:TextBox>
</form>
</body>
</html>
Jun 4 '07 #1
4 5935
Apparently this is the default behavior of an ASP.NET page with only one
textbox on it. For example if there were a page that had a search textbox and
no button to submit the search, you could type in a search term and hit the
ENTER key and the form would be submitted.

There are lots of techniques and new features in ASP.NET 2.0 that let you
customize this type of behavior, such as the "defaultbutton" property of the
FORM element.

But the bottom line is, there's nothing wrong with your Framework - that's
just "the way it is".
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Renaud Langis" wrote:
Hello,

I have a strange yet very simple problem with the asp.net Textbox web control.

On an empty asp.net page, add a single asp:TextBox control with
Autopostback=false with nothing else on the page.

according to the doc, hitting Enter while the TextBox has focus should do
nothing since Autopostback=false. The problem i have is that it posts the
form (that is, it ignores the Autopostback=false).

Now if i add another textbox to the page, i no longer experience the
problem(???????????).

Is my framework (2.0) corrupted or is anyone else able to reproduce that bug?

Thanks for any help

Renaud

=============
sample page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<html>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" ID="txt" AutoPostBack="false"
</asp:TextBox>
</form>
</body>
</html>
Jun 4 '07 #2
The main problem with this behavior is that it bypasses the control
validations.
If the textbox is a TextBoxValidator, hitting the enter key posts the form
even if the textbox content breaks the validation rules. Validations are
performed correctly on the server side but it's still a useless roundtrip to
the server.

I suppose this could be corrected by using a button on the page. The problem
is, in our application, buttons are replaced by LinkButtons.

Thanks for your quick answer.

Renaud

"Peter Bromberg [C# MVP]" wrote:
Apparently this is the default behavior of an ASP.NET page with only one
textbox on it. For example if there were a page that had a search textbox and
no button to submit the search, you could type in a search term and hit the
ENTER key and the form would be submitted.

There are lots of techniques and new features in ASP.NET 2.0 that let you
customize this type of behavior, such as the "defaultbutton" property of the
FORM element.

But the bottom line is, there's nothing wrong with your Framework - that's
just "the way it is".
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Renaud Langis" wrote:
Hello,

I have a strange yet very simple problem with the asp.net Textbox web control.

On an empty asp.net page, add a single asp:TextBox control with
Autopostback=false with nothing else on the page.

according to the doc, hitting Enter while the TextBox has focus should do
nothing since Autopostback=false. The problem i have is that it posts the
form (that is, it ignores the Autopostback=false).

Now if i add another textbox to the page, i no longer experience the
problem(???????????).

Is my framework (2.0) corrupted or is anyone else able to reproduce that bug?

Thanks for any help

Renaud

=============
sample page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<html>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" ID="txt" AutoPostBack="false"
></asp:TextBox>
</form>
</body>
</html>
Jun 5 '07 #3
Have you tried something like adding another Textbox to your page, and
setting its width property to zero?
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Renaud Langis" wrote:
The main problem with this behavior is that it bypasses the control
validations.
If the textbox is a TextBoxValidator, hitting the enter key posts the form
even if the textbox content breaks the validation rules. Validations are
performed correctly on the server side but it's still a useless roundtrip to
the server.

I suppose this could be corrected by using a button on the page. The problem
is, in our application, buttons are replaced by LinkButtons.

Thanks for your quick answer.

Renaud

"Peter Bromberg [C# MVP]" wrote:
Apparently this is the default behavior of an ASP.NET page with only one
textbox on it. For example if there were a page that had a search textbox and
no button to submit the search, you could type in a search term and hit the
ENTER key and the form would be submitted.

There are lots of techniques and new features in ASP.NET 2.0 that let you
customize this type of behavior, such as the "defaultbutton" property of the
FORM element.

But the bottom line is, there's nothing wrong with your Framework - that's
just "the way it is".
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Renaud Langis" wrote:
Hello,
>
I have a strange yet very simple problem with the asp.net Textbox web control.
>
On an empty asp.net page, add a single asp:TextBox control with
Autopostback=false with nothing else on the page.
>
according to the doc, hitting Enter while the TextBox has focus should do
nothing since Autopostback=false. The problem i have is that it posts the
form (that is, it ignores the Autopostback=false).
>
Now if i add another textbox to the page, i no longer experience the
problem(???????????).
>
Is my framework (2.0) corrupted or is anyone else able to reproduce that bug?
>
Thanks for any help
>
Renaud
>
=============
sample page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<html>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" ID="txt" AutoPostBack="false"
</asp:TextBox>
</form>
</body>
</html>
Jun 5 '07 #4
Yes, i solved it by adding a TextBox with display:none

It's not nice but it works...

Thanks

Renaud

"Peter Bromberg [C# MVP]" wrote:
Have you tried something like adding another Textbox to your page, and
setting its width property to zero?
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Renaud Langis" wrote:
The main problem with this behavior is that it bypasses the control
validations.
If the textbox is a TextBoxValidator, hitting the enter key posts the form
even if the textbox content breaks the validation rules. Validations are
performed correctly on the server side but it's still a useless roundtrip to
the server.

I suppose this could be corrected by using a button on the page. The problem
is, in our application, buttons are replaced by LinkButtons.

Thanks for your quick answer.

Renaud

"Peter Bromberg [C# MVP]" wrote:
Apparently this is the default behavior of an ASP.NET page with only one
textbox on it. For example if there were a page that had a search textbox and
no button to submit the search, you could type in a search term and hit the
ENTER key and the form would be submitted.
>
There are lots of techniques and new features in ASP.NET 2.0 that let you
customize this type of behavior, such as the "defaultbutton" property of the
FORM element.
>
But the bottom line is, there's nothing wrong with your Framework - that's
just "the way it is".
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
>
>
>
>
"Renaud Langis" wrote:
>
Hello,

I have a strange yet very simple problem with the asp.net Textbox web control.

On an empty asp.net page, add a single asp:TextBox control with
Autopostback=false with nothing else on the page.

according to the doc, hitting Enter while the TextBox has focus should do
nothing since Autopostback=false. The problem i have is that it posts the
form (that is, it ignores the Autopostback=false).

Now if i add another textbox to the page, i no longer experience the
problem(???????????).

Is my framework (2.0) corrupted or is anyone else able to reproduce that bug?

Thanks for any help

Renaud

=============
sample page
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<html>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" ID="txt" AutoPostBack="false"
></asp:TextBox>
</form>
</body>
</html>
Jun 5 '07 #5

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

Similar topics

0
by: Scott | last post by:
I have a textbox to enter an email address followed by a password textbox. The email has a regularexpressionvalidator and a requiredfieldvalidator. The ReqField works fine, but if I put in an...
4
by: Anil Rajan | last post by:
hi, Bug or problem ? suppose my page consist of 1 textbox and 1 button(server control) and focus is on textbox and i press enter key ,in normal circumstances the page should execute the...
12
by: ABC - Sébastien Beaugrand | last post by:
Hi, I've been trying to get an answer from french newsgroup but I did'nt succeed in this, so I'll try on this group and sorry for my poor english. The description of the bug : The...
56
by: Rob Dob | last post by:
VS2005 is a PIECE of Garbage and is bug Ridden, I wonder how many others feel the same, I am so sorry that I have moved away from VS2003, VS2005 is unstable, and half the stuff doesn't work, ...
0
by: ABC | last post by:
I write windows form application using VS2005. Don't know why all textbox still selected all text when leave textbox, Is it has bug?
21
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button is the Cancel button. WHen the user clicks on...
8
by: Terry | last post by:
I have noiticed a change in behavior between VB6 and VB.Net (2003 and 2005) that I don't find documented anywhere. It has to do with 'causesvalidation' and the button on the Form defined to be the...
1
by: Arpan | last post by:
Suppose I have the following RequiredFieldValidator control which validates a TextBox: <form id="form1" runat="server"> <asp:TextBox id="txtVal" runat="server"/> <asp:RequiredFieldValidator...
14
by: teddysnips | last post by:
WINDOWS FORMS I've a form that has a textbox that allows the user to enter a string. On the LostFocus event, the textbox formats the string into a preferred format. However, if the user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.