|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ENTER and formsI have used Page.RegisterHiddenField("__EVENTTARGET", "btnFind"); This works SOMETIMES but not all the time. I saw http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsformclassactivatedtopic.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclassgotfocustopic.asp which explains that ENTER is not used since the Activate is used for Forms. I understand the logic but I still cant get my forms to always submit on ENTER and instead it uses the first control (a list) and ends up being redirected. Enter has been used for decades to submit a request dating back to "dumb terminals" and even typewriters. So it makes sense to use the ENTER to submit forms. Hi,
As far as ASP .NET forms are concerned (the MSDN article you're referring to speaks about Windows Forms which are quite a different technology having nothing to do with Web programming), there is a special type of the <INPUT> control - <INPUT TYPE="Submit">. This control corresponds to the System.Web.UI.WebControls.Button control in ASP .NET. Just make sure not to define the CommandName and OnCommand properties on the Web form for the button control to be rendered as the submit and not a command button. -- Show quoteHide quoteSincerely, Dmitriy Lapshin [C# / .NET MVP] Bring the power of unit testing to the VS .NET IDE today! http://www.x-unity.net/teststudio.aspx "news" <sa***@logicians.com> wrote in message news:CViQd.14994$8B3.2362@text.news.blueyonder.co.uk... > Can I use ENTER to submit my form using C#? > > I have used > Page.RegisterHiddenField("__EVENTTARGET", "btnFind"); > > > > This works SOMETIMES but not all the time. > > > > I saw > > > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsformclassactivatedtopic.asp > > > > and > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclassgotfocustopic.asp > > > > which explains that ENTER is not used since the Activate is used for > Forms. > I understand the logic but I still cant get my forms to always submit on > ENTER and instead it uses the first control (a list) and ends up being > redirected. > > > > Enter has been used for decades to submit a request dating back to "dumb > terminals" and even typewriters. So it makes sense to use the ENTER to > submit forms. > > here is a gem
http://www.allasp.net/enterkey.aspx -- Show quoteHide quoteRegards, Alvin Bruney [Microsoft MVP ASP.NET] [Shameless Author plug] The Microsoft Office Web Components Black Book with .NET Now Available @ http://www.lulu.com/owc ---------------------------------------------------------- "news" <sa***@logicians.com> wrote in message news:CViQd.14994$8B3.2362@text.news.blueyonder.co.uk... > Can I use ENTER to submit my form using C#? > > I have used > Page.RegisterHiddenField("__EVENTTARGET", "btnFind"); > > > > This works SOMETIMES but not all the time. > > > > I saw > > > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsformclassactivatedtopic.asp > > > > and > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclassgotfocustopic.asp > > > > which explains that ENTER is not used since the Activate is used for > Forms. > I understand the logic but I still cant get my forms to always submit on > ENTER and instead it uses the first control (a list) and ends up being > redirected. > > > > Enter has been used for decades to submit a request dating back to "dumb > terminals" and even typewriters. So it makes sense to use the ENTER to > submit forms. > >
Other interesting topics
RE: For vs. For Each
StreamWriter.close() hangs in multithreaded execution what is the best way to read text file I need some help with remote acces to a help file Windows service & Web service Interprocess Communication How to make an assembly search for its dependent DLLs in a specific path (other than the installed d .net and mysql join How does IIS or Framework set the Content-Length header ? Record my webcam reflector |
|||||||||||||||||||||||