Results 1 to 10 of 10

Thread: When user presses enter...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    28

    When user presses enter...

    Ok im having a problem that seems so simple, but i am just unable to find an answer by searching...

    Basically what im trying to do is make it so when the user presses enter on the keyboard it presses a certain button on the page. For Example: The user types in their username and password and presses enter, this clicks the "login" button rather than multiple other buttons on the webform. The answer to this would solve half of my problem.

    The other half is, i need to click a link in the datagrid when the user presses enter, for example: The user clicks edit, then starts typing in the textbox they need edited, when they are done most users will probably hit the enter key so i would like this to click the Update link in the datagrid, or the alternative of just doing nothing, if clicking update is not possible or very difficult.

    I am using VS 2003, C# Webform

  2. #2
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: When user presses enter...

    You could set a event handler on the keys, and when the user click the enter key, simply call the method for the event handler as of the button.

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: When user presses enter...

    I guess it's the "DefaultButton" property
    HTML Code:
    <form id="form1" runat="server" defaultbutton="Button1">
    Last edited by ComputerJy; Sep 1st, 2006 at 06:32 PM.
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    28

    Re: When user presses enter...

    I dont think that works for a webform, because there is nothing close to that in the properties window

    also... is that vs 2005?

  5. #5
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: When user presses enter...

    sorry, didn't read your entire post
    updated
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  6. #6
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: When user presses enter...

    sorry, didnt see it was a webform - jen

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    28

    Re: When user presses enter...

    kewl ill try that out on tuesday when i get back in the office, thx guyz

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: When user presses enter...

    WebForms questions go in the ASP.NET forum.

    The submit button is the default. That is all that the DefaultButton property controls.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2006
    Posts
    28

    Re: When user presses enter...

    welp, turns out i dont have that option for "defaultbutton="Button1""

  10. #10
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: When user presses enter...

    Quote Originally Posted by HardD99
    welp, turns out i dont have that option for "defaultbutton="Button1""
    Sorry, it seems to be a new feature in v2.0 that doesn't exist in 1.1
    I guess you'll have to go JenniferBabe's way
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width