By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,483 Members | 3,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,483 IT Pros & Developers. It's quick & easy.

How to set my save button to default?

P: n/a
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to set one
of this buttons to default when I press enter?

/Marre
Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
is it a win application?
if yes, on the form is a property acceptbutton
"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to set one of this buttons to default when I press enter?

/Marre

Nov 15 '05 #2

P: n/a
Just put this in your Page_Load:
Page.RegisterHiddenField("__EVENTTARGET", "ButtonName")
Change ButtonName to the name of your default button.

"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi Stefan!

No. Its a web application.

Forgot to mention that :)

/Marre
"Stefan" <sh****@steffsworld.ch> wrote in message
news:OU*************@tk2msftngp13.phx.gbl...
is it a win application?
if yes, on the form is a property acceptbutton
"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to
set one
of this buttons to default when I press enter?

/Marre



Nov 15 '05 #3

P: n/a
I'm quite confident the other answer is probably what you want. But just in
case, if you have multiple "default" buttons based upon different text
boxes, this javascript could come in handy: (e.g. a bunch of textbox /
button pairs and you want enter to "submit" based on the textbox the user is
currently in...)

http://www.kamp-hansen.dk/pages/show...d=21&menuid=20

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi Stefan!

No. Its a web application.

Forgot to mention that :)

/Marre
"Stefan" <sh****@steffsworld.ch> wrote in message
news:OU*************@tk2msftngp13.phx.gbl...
is it a win application?
if yes, on the form is a property acceptbutton
"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to
set one
of this buttons to default when I press enter?

/Marre



Nov 15 '05 #4

P: n/a
If your form is form1 and your save button is button1, then set the
AcceptButton property of form1 equal to button1:

form1.AcceptButton = button1;

I believe (but I may be mistaken) that this will make the default behavior
of the enter key execute the button1_click event.

http://msdn.microsoft.com/library/de...uttontopic.asp

- cfenley

"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to set one of this buttons to default when I press enter?

/Marre

Nov 15 '05 #5

P: n/a
Hi there,

if it's a windows form then, set the AcceptButton Property
of Form to the ButtonX. And another important thing is
setting the tab order of the ButtonX to 0.
Justine
-----Original Message-----
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to set oneof this buttons to default when I press enter?

/Marre
.

Nov 15 '05 #6

P: n/a
Thanx all!

Ive solved the problem with Mike Mayers javascript.

/Marre
"Marre" <su**@supremelink.nu> wrote in message
news:bi************@ID-128323.news.uni-berlin.de...
Hi all!

I have a form with a lot of buttons on it. Dos anyone knows how to set one of this buttons to default when I press enter?

/Marre

Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.