Thanks for your quick reply Mark,
For the front page behavior, it is actually abit related to the
webbrowser's handling of key press when you have focus on a textbox in
browser. When your page have some textbox and submit button on page, and if
you press enter key (when focus on a textbox), the browser will submit the
page/form. this is also true for ASP.NET page, however, ASP.NET button's
"click" event is not a simple form submit, so that won't work if you need
to invoke button's postback event.
Actually, in addition to the javascript approach(I mentioned eariler which
is the most reliable and common means), you can also use the
"defaultButton" feature in ASP.NET page. For example:
#set default button attribute for <formto the ID of the button control
=================
<form id="form1" runat="server" defaultbutton="Button1" >
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
=============
You can also apply default button on a Panel control. e.g.
=============
<asp:panel defaultbutton=ˇ±btnOKˇ± runat=ˇ±serverˇ±>
......
</asp:panel>
=============
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Mark B" <no**@none.com>
References: <en**************@TK2MSFTNGP03.phx.gbl>
<1Q**************@TK2MSFTNGHUB02.phx.gbl>
>In-Reply-To: <1Q**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: Need Enter key to trigger post
Date: Tue, 17 Jun 2008 14:37:14 +1200
When I used to use FrontPage (a few weeks ago before downloading Visual
Web
>Developer 2008 Express), all I did was insert a button on a webpage and it
defaulted to be a submit button as well as automatically created a form.
So
>from there whenever I pressed Enter on the webpage it automatically
submitted.
Now with VWDExpress 2008 I tried to do the same thing; that is drag a
button
>and then a text box onto a blank webpage.
There seems to be no automatic creation of a form and a submit button.
I'll
>plan have a read through the articles you mentioned and see if they do
allow
>me to emulate the FrontPage generated functionality.
Thanks.
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:1Q**************@TK2MSFTNGHUB02.phx.gbl...
>Hi Mark,
As for the first question, you can add some javascript for the
TextBox(input field)'s "onkeydown" event and post the form. Here are some
web articles mentioned this:
#Enter Key in ASP.NET - Complete Research
http://www.beansoftware.com/ASP.NET-...Enter-Key.aspx
#Default Button Submissions in ASP.NET Pages
http://www.west-wind.com/WebLog/posts/1225.aspx
#Setting the default Button for a TextBox in ASP.NET
http://weblogs.asp.net/rajbk/archive...fault-button-f
>or-a-textbox-in-asp-net.aspx
For the second question, "Response.Write" will always output the
parameter
>from the begining of the response stream, therefore, your output will
generally display at the top of the page. Also, if you want to display
some
message on page to users, I suggest you use the following means instead
of
>Response.Write: