enter key hell problem 2
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

gh0st54
Hi me again

problem 2

on pages that have no user controls i want to submit using the enter key

i register
Page.RegisterHiddenField("__EVENTTARGET", "btnSubmit");

when i press enter it doesn't fire

what am i missing ???
Reply to this message...
 
    
Steve C. Orr [MVP, MCSD] (VIP)
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"gh0st54" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Matt Berther
Hello Click here to reveal e-mail address,

I've had a post that discusses how to accomplish this on my website:

http://www.mattberther.com/2003/06/000125.html

--
Matt Berther
http://www.mattberther.com

[Original message clipped]

Reply to this message...
 
    
gh0st54
Sorry
I tried it but doesn't work

i'm being sent back to index.aspx ??? weird

so what i do know is

if(!Page.IsPostBack)
            {
bla bla bla .....
                Page.RegisterHiddenField("__EVENTTARGET","submit" );

                this.txtSendTo.Attributes.Add("onFocus","javascript:SetTarget('submit');");
                this.txtSubject.Attributes.Add("onFocus","javascript:SetTarget('submit');");
                this.txtMessage.Attributes.Add("onFocus","javascript:SetTarget('notsubmit');");
            }

            if(Page.IsPostBack){
                if(Page.Request.Form["__EVENTTARGET"].ToString().ToLower()=="submit"){
                    this.Send();
                }
            }

I know it's ugly but it works.

there has to be something not that ugly

Matt Berther <Click here to reveal e-mail address> wrote in message news:<Click here to reveal e-mail address>...
[Original message clipped]

Reply to this message...
 
    
Girish bharadwaj
have you checked out Scott's blog here:
http://www.hanselman.com/blog/PermaLink.aspx?guid=3f96f2ee-331f-480a-81af-dd62c8f92c23

That covers a few of them.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"gh0st54" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

");
[Original message clipped]

Reply to this message...
 
    
Alvin Bruney [MVP]
start here
http://www.allasp.net/enterkey.aspx

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"gh0st54" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Web.UI.Page




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com