Multiple buttons from different ASP.NET controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a web form that includes mutiple controls, each of which has its own submit button. Problem is, when I hit "enter" in any of the form fields, irregardless of which component it comes from, the first form button is ALWAYS activated

is there a way to control which form button has "precedence" on a WebForm page using server-side forms? Check it out at http://www.accessquery.com - go to the job search area, enter in your keywords and hit enter - it takes you to the websearch page b/c that form and button occur at the top of the index page and hence get priority. It SHOULD take you to the job search results page

I tried setting the tab index of that top image button to be 99, but that didn't have any affect. I also tried setting the focus on that button via javascript, but that only sometimes works (very weird

Thanks

-- Jak
 
There use to be a good description at this URL, but it doesn't seem to be
functioning.
http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=20
(if you get into that above URL, please e-mail the page! (IE save as *.html,
then ship it to me)

These guys seem to have a better page, I think the javascript looks the
same:
http://www.allasp.net/enterkey.aspx

--
Mike Mayer - Visual C# MVP
http://www.mag37.com/csharp/
(e-mail address removed)


Jacob Anderson said:
Hi,

I have a web form that includes mutiple controls, each of which has its
own submit button. Problem is, when I hit "enter" in any of the form
fields, irregardless of which component it comes from, the first form button
is ALWAYS activated.
is there a way to control which form button has "precedence" on a WebForm
page using server-side forms? Check it out at http://www.accessquery.com -
go to the job search area, enter in your keywords and hit enter - it takes
you to the websearch page b/c that form and button occur at the top of the
index page and hence get priority. It SHOULD take you to the job search
results page.
I tried setting the tab index of that top image button to be 99, but that
didn't have any affect. I also tried setting the focus on that button via
javascript, but that only sometimes works (very weird)
 
Ahh, found it on archive.org, but my internet connection seems to be wacko.
http://web.archive.org/web/20030620...k/pages/showdoc.asp?id=28&menuid=21&menuid=20

And made my own copy here:
http://www.mag37.com/csharp/articles/DefaultSubmitButton.html

--
Mike Mayer - Visual C# MVP
http://www.mag37.com/csharp/
(e-mail address removed)



Michael Mayer said:
There use to be a good description at this URL, but it doesn't seem to be
functioning.
http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=20
(if you get into that above URL, please e-mail the page! (IE save as *.html,
then ship it to me)

These guys seem to have a better page, I think the javascript looks the
same:
http://www.allasp.net/enterkey.aspx

--
Mike Mayer - Visual C# MVP
http://www.mag37.com/csharp/
(e-mail address removed)



own submit button. Problem is, when I hit "enter" in any of the form
fields, irregardless of which component it comes from, the first form button
is ALWAYS activated. WebForm
page using server-side forms? Check it out at
http://www.accessquery.com -
 
Back
Top