Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Choosing whitch button will act as submit button

Reply
Thread Tools

Choosing whitch button will act as submit button

 
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      12-10-2006
Hello.

There maybe an simple answer to this, but sometimes one get a strange
blindness when working intensely on one single problem.

I'm using ASP.NET 2003, building pages that include 3 user controls (banner,
top-menu and sub-menu). The top-menu contains like five asp:buttons.

Further down the form there is search field with another asp:button. And I
naturally want this button to act as submit button in the sense that when
the user push the [enter] button in the search field. Well, this doesn't
happen. The first (left) button on the usercontol top-menu fires, whitch
brings the user to completely different page (whitch is the intention when
the user actually clicks this button)

I have tried to add another form tag for this, but no thank you, only one
server side form tag, please!

I have tried various ugly workarounds, like passing session variables so
that the button in the top-menu actually clicks back on the other button. No
luck.

Anyone with an idea on how to pick whitch button that will act as submit
button, when usercontrols with buttons are included?

Thanks.


Regards
Bjorn


 
Reply With Quote
 
 
 
 
Microsoft
Guest
Posts: n/a
 
      12-10-2006
Yes, This will prevent any enter key submiting. However, you can extend this
to allow the one you want to submit.

http://www.trainingon.net/Articles/Art147/Art147.html



--

Best Regards - OHM

http://TrainingOn.net
--------------------------------------------------


"Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello.
>
> There maybe an simple answer to this, but sometimes one get a strange
> blindness when working intensely on one single problem.
>
> I'm using ASP.NET 2003, building pages that include 3 user controls
> (banner, top-menu and sub-menu). The top-menu contains like five
> asp:buttons.
>
> Further down the form there is search field with another asp:button. And I
> naturally want this button to act as submit button in the sense that when
> the user push the [enter] button in the search field. Well, this doesn't
> happen. The first (left) button on the usercontol top-menu fires, whitch
> brings the user to completely different page (whitch is the intention when
> the user actually clicks this button)
>
> I have tried to add another form tag for this, but no thank you, only one
> server side form tag, please!
>
> I have tried various ugly workarounds, like passing session variables so
> that the button in the top-menu actually clicks back on the other button.
> No luck.
>
> Anyone with an idea on how to pick whitch button that will act as submit
> button, when usercontrols with buttons are included?
>
> Thanks.
>
>
> Regards
> Bjorn
>



 
Reply With Quote
 
 
 
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      12-10-2006
Yes, I have been thinking of trapping the enter key (ascii 13), but this has
to be done in the asp:textbox (I think), and I am not sure how to do this.
Maybe in a page event, but which?
I using VB, so I would be grateful for any code example in VB.

Bjorn

"Microsoft" <news.microsoft.com> wrote in message
news:(E-Mail Removed)...
> Yes, This will prevent any enter key submiting. However, you can extend
> this to allow the one you want to submit.
>
> http://www.trainingon.net/Articles/Art147/Art147.html
>
>
>
> --
>
> Best Regards - OHM
>
> http://TrainingOn.net
> --------------------------------------------------
>
>
> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello.
>>
>> There maybe an simple answer to this, but sometimes one get a strange
>> blindness when working intensely on one single problem.
>>
>> I'm using ASP.NET 2003, building pages that include 3 user controls
>> (banner, top-menu and sub-menu). The top-menu contains like five
>> asp:buttons.
>>
>> Further down the form there is search field with another asp:button. And
>> I naturally want this button to act as submit button in the sense that
>> when the user push the [enter] button in the search field. Well, this
>> doesn't happen. The first (left) button on the usercontol top-menu fires,
>> whitch brings the user to completely different page (whitch is the
>> intention when the user actually clicks this button)
>>
>> I have tried to add another form tag for this, but no thank you, only one
>> server side form tag, please!
>>
>> I have tried various ugly workarounds, like passing session variables so
>> that the button in the top-menu actually clicks back on the other button.
>> No luck.
>>
>> Anyone with an idea on how to pick whitch button that will act as submit
>> button, when usercontrols with buttons are included?
>>
>> Thanks.
>>
>>
>> Regards
>> Bjorn
>>

>
>



 
Reply With Quote
 
OHM
Guest
Posts: n/a
 
      12-10-2006
This needs to be done on the client side using script langauge. You need to
trap the onkeydown event of the body tag.

--

Best Regards - OHM

http://TrainingOn.net
--------------------------------------------------


"Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, I have been thinking of trapping the enter key (ascii 13), but this
> has to be done in the asp:textbox (I think), and I am not sure how to do
> this. Maybe in a page event, but which?
> I using VB, so I would be grateful for any code example in VB.
>
> Bjorn
>
> "Microsoft" <news.microsoft.com> wrote in message
> news:(E-Mail Removed)...
>> Yes, This will prevent any enter key submiting. However, you can extend
>> this to allow the one you want to submit.
>>
>> http://www.trainingon.net/Articles/Art147/Art147.html
>>
>>
>>
>> --
>>
>> Best Regards - OHM
>>
>> http://TrainingOn.net
>> --------------------------------------------------
>>
>>
>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hello.
>>>
>>> There maybe an simple answer to this, but sometimes one get a strange
>>> blindness when working intensely on one single problem.
>>>
>>> I'm using ASP.NET 2003, building pages that include 3 user controls
>>> (banner, top-menu and sub-menu). The top-menu contains like five
>>> asp:buttons.
>>>
>>> Further down the form there is search field with another asp:button. And
>>> I naturally want this button to act as submit button in the sense that
>>> when the user push the [enter] button in the search field. Well, this
>>> doesn't happen. The first (left) button on the usercontol top-menu
>>> fires, whitch brings the user to completely different page (whitch is
>>> the intention when the user actually clicks this button)
>>>
>>> I have tried to add another form tag for this, but no thank you, only
>>> one server side form tag, please!
>>>
>>> I have tried various ugly workarounds, like passing session variables so
>>> that the button in the top-menu actually clicks back on the other
>>> button. No luck.
>>>
>>> Anyone with an idea on how to pick whitch button that will act as submit
>>> button, when usercontrols with buttons are included?
>>>
>>> Thanks.
>>>
>>>
>>> Regards
>>> Bjorn
>>>

>>
>>

>
>



 
Reply With Quote
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      12-10-2006
All right, I give in. Although I think it is kind of stupid that the
server-code cannot decide whitch button should be the submit button. I even
tried to tingle with the tabindex. I mean, on the form_load it should be
easy enough to state this.

But since I am fairly new to client scripting I couldn't make that work
either. I tried something like this:
<script language =vbscript>
Sub Search

if window.event.keyCode=13 then

event.returnvalue=False

event.cancel=True

endif

end sub

</script>

I only get a page error.

Regards
Bjorn

"OHM" <news.microsoft.com> wrote in message
news:u7oFp%(E-Mail Removed)...
> This needs to be done on the client side using script langauge. You need
> to trap the onkeydown event of the body tag.
>
> --
>
> Best Regards - OHM
>
> http://TrainingOn.net
> --------------------------------------------------
>
>
> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Yes, I have been thinking of trapping the enter key (ascii 13), but this
>> has to be done in the asp:textbox (I think), and I am not sure how to do
>> this. Maybe in a page event, but which?
>> I using VB, so I would be grateful for any code example in VB.
>>
>> Bjorn
>>
>> "Microsoft" <news.microsoft.com> wrote in message
>> news:(E-Mail Removed)...
>>> Yes, This will prevent any enter key submiting. However, you can extend
>>> this to allow the one you want to submit.
>>>
>>> http://www.trainingon.net/Articles/Art147/Art147.html
>>>
>>>
>>>
>>> --
>>>
>>> Best Regards - OHM
>>>
>>> http://TrainingOn.net
>>> --------------------------------------------------
>>>
>>>
>>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hello.
>>>>
>>>> There maybe an simple answer to this, but sometimes one get a strange
>>>> blindness when working intensely on one single problem.
>>>>
>>>> I'm using ASP.NET 2003, building pages that include 3 user controls
>>>> (banner, top-menu and sub-menu). The top-menu contains like five
>>>> asp:buttons.
>>>>
>>>> Further down the form there is search field with another asp:button.
>>>> And I naturally want this button to act as submit button in the sense
>>>> that when the user push the [enter] button in the search field. Well,
>>>> this doesn't happen. The first (left) button on the usercontol top-menu
>>>> fires, whitch brings the user to completely different page (whitch is
>>>> the intention when the user actually clicks this button)
>>>>
>>>> I have tried to add another form tag for this, but no thank you, only
>>>> one server side form tag, please!
>>>>
>>>> I have tried various ugly workarounds, like passing session variables
>>>> so that the button in the top-menu actually clicks back on the other
>>>> button. No luck.
>>>>
>>>> Anyone with an idea on how to pick whitch button that will act as
>>>> submit button, when usercontrols with buttons are included?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> Regards
>>>> Bjorn
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Mark Fitzpatrick
Guest
Posts: n/a
 
      12-10-2006
Use the script exactly as supplied for the browser. You don't want to use
VBScript on the client side, JavaScript is the universal way. Server code
cannot decide which button should be the submit since this is controlled by
the browser itself and the browser has it's own way of determining which
should be the submit, usually the first button that can postback that exists
within the forms control hierarchy.


--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006



"Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> All right, I give in. Although I think it is kind of stupid that the
> server-code cannot decide whitch button should be the submit button. I
> even tried to tingle with the tabindex. I mean, on the form_load it should
> be easy enough to state this.
>
> But since I am fairly new to client scripting I couldn't make that work
> either. I tried something like this:
> <script language =vbscript>
> Sub Search
>
> if window.event.keyCode=13 then
>
> event.returnvalue=False
>
> event.cancel=True
>
> endif
>
> end sub
>
> </script>
>
> I only get a page error.
>
> Regards
> Bjorn
>
> "OHM" <news.microsoft.com> wrote in message
> news:u7oFp%(E-Mail Removed)...
>> This needs to be done on the client side using script langauge. You need
>> to trap the onkeydown event of the body tag.
>>
>> --
>>
>> Best Regards - OHM
>>
>> http://TrainingOn.net
>> --------------------------------------------------
>>
>>
>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Yes, I have been thinking of trapping the enter key (ascii 13), but this
>>> has to be done in the asp:textbox (I think), and I am not sure how to do
>>> this. Maybe in a page event, but which?
>>> I using VB, so I would be grateful for any code example in VB.
>>>
>>> Bjorn
>>>
>>> "Microsoft" <news.microsoft.com> wrote in message
>>> news:(E-Mail Removed)...
>>>> Yes, This will prevent any enter key submiting. However, you can extend
>>>> this to allow the one you want to submit.
>>>>
>>>> http://www.trainingon.net/Articles/Art147/Art147.html
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Best Regards - OHM
>>>>
>>>> http://TrainingOn.net
>>>> --------------------------------------------------
>>>>
>>>>
>>>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Hello.
>>>>>
>>>>> There maybe an simple answer to this, but sometimes one get a strange
>>>>> blindness when working intensely on one single problem.
>>>>>
>>>>> I'm using ASP.NET 2003, building pages that include 3 user controls
>>>>> (banner, top-menu and sub-menu). The top-menu contains like five
>>>>> asp:buttons.
>>>>>
>>>>> Further down the form there is search field with another asp:button.
>>>>> And I naturally want this button to act as submit button in the sense
>>>>> that when the user push the [enter] button in the search field. Well,
>>>>> this doesn't happen. The first (left) button on the usercontol
>>>>> top-menu fires, whitch brings the user to completely different page
>>>>> (whitch is the intention when the user actually clicks this button)
>>>>>
>>>>> I have tried to add another form tag for this, but no thank you, only
>>>>> one server side form tag, please!
>>>>>
>>>>> I have tried various ugly workarounds, like passing session variables
>>>>> so that the button in the top-menu actually clicks back on the other
>>>>> button. No luck.
>>>>>
>>>>> Anyone with an idea on how to pick whitch button that will act as
>>>>> submit button, when usercontrols with buttons are included?
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> Regards
>>>>> Bjorn
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      12-11-2006
Thanks, I think I'm beginning to understand the concept now. The script
almost works, disabling the [ENTER] keypress, but I haven't yet been
successful in executing the desired button_click action instead. This
application is for my company's Intranet, so VBScript will do in the first
place, everyone is stuck with Microsoft, except for Lotus Notes for mail.
But I will start learning the basics of JavaScript for puposes like this.

Bjorn

"Mark Fitzpatrick" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Use the script exactly as supplied for the browser. You don't want to use
> VBScript on the client side, JavaScript is the universal way. Server code
> cannot decide which button should be the submit since this is controlled
> by the browser itself and the browser has it's own way of determining
> which should be the submit, usually the first button that can postback
> that exists within the forms control hierarchy.
>
>
> --
>
> Hope this helps,
> Mark Fitzpatrick
> Former Microsoft FrontPage MVP 199?-2006
>
>
>
> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> All right, I give in. Although I think it is kind of stupid that the
>> server-code cannot decide whitch button should be the submit button. I
>> even tried to tingle with the tabindex. I mean, on the form_load it
>> should be easy enough to state this.
>>
>> But since I am fairly new to client scripting I couldn't make that work
>> either. I tried something like this:
>> <script language =vbscript>
>> Sub Search
>>
>> if window.event.keyCode=13 then
>>
>> event.returnvalue=False
>>
>> event.cancel=True
>>
>> endif
>>
>> end sub
>>
>> </script>
>>
>> I only get a page error.
>>
>> Regards
>> Bjorn
>>
>> "OHM" <news.microsoft.com> wrote in message
>> news:u7oFp%(E-Mail Removed)...
>>> This needs to be done on the client side using script langauge. You need
>>> to trap the onkeydown event of the body tag.
>>>
>>> --
>>>
>>> Best Regards - OHM
>>>
>>> http://TrainingOn.net
>>> --------------------------------------------------
>>>
>>>
>>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Yes, I have been thinking of trapping the enter key (ascii 13), but
>>>> this has to be done in the asp:textbox (I think), and I am not sure how
>>>> to do this. Maybe in a page event, but which?
>>>> I using VB, so I would be grateful for any code example in VB.
>>>>
>>>> Bjorn
>>>>
>>>> "Microsoft" <news.microsoft.com> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Yes, This will prevent any enter key submiting. However, you can
>>>>> extend this to allow the one you want to submit.
>>>>>
>>>>> http://www.trainingon.net/Articles/Art147/Art147.html
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Best Regards - OHM
>>>>>
>>>>> http://TrainingOn.net
>>>>> --------------------------------------------------
>>>>>
>>>>>
>>>>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>>>>> news:(E-Mail Removed)...
>>>>>> Hello.
>>>>>>
>>>>>> There maybe an simple answer to this, but sometimes one get a strange
>>>>>> blindness when working intensely on one single problem.
>>>>>>
>>>>>> I'm using ASP.NET 2003, building pages that include 3 user controls
>>>>>> (banner, top-menu and sub-menu). The top-menu contains like five
>>>>>> asp:buttons.
>>>>>>
>>>>>> Further down the form there is search field with another asp:button.
>>>>>> And I naturally want this button to act as submit button in the sense
>>>>>> that when the user push the [enter] button in the search field. Well,
>>>>>> this doesn't happen. The first (left) button on the usercontol
>>>>>> top-menu fires, whitch brings the user to completely different page
>>>>>> (whitch is the intention when the user actually clicks this button)
>>>>>>
>>>>>> I have tried to add another form tag for this, but no thank you, only
>>>>>> one server side form tag, please!
>>>>>>
>>>>>> I have tried various ugly workarounds, like passing session variables
>>>>>> so that the button in the top-menu actually clicks back on the other
>>>>>> button. No luck.
>>>>>>
>>>>>> Anyone with an idea on how to pick whitch button that will act as
>>>>>> submit button, when usercontrols with buttons are included?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>> Regards
>>>>>> Bjorn
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      12-12-2006
Yes, now everthing works like a dream. Just a little client scripting was
all it took.
Thanks everyone.

Bjorn

"Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks, I think I'm beginning to understand the concept now. The script
> almost works, disabling the [ENTER] keypress, but I haven't yet been
> successful in executing the desired button_click action instead. This
> application is for my company's Intranet, so VBScript will do in the first
> place, everyone is stuck with Microsoft, except for Lotus Notes for mail.
> But I will start learning the basics of JavaScript for puposes like this.
>
> Bjorn
>
> "Mark Fitzpatrick" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Use the script exactly as supplied for the browser. You don't want to use
>> VBScript on the client side, JavaScript is the universal way. Server code
>> cannot decide which button should be the submit since this is controlled
>> by the browser itself and the browser has it's own way of determining
>> which should be the submit, usually the first button that can postback
>> that exists within the forms control hierarchy.
>>
>>
>> --
>>
>> Hope this helps,
>> Mark Fitzpatrick
>> Former Microsoft FrontPage MVP 199?-2006
>>
>>
>>
>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> All right, I give in. Although I think it is kind of stupid that the
>>> server-code cannot decide whitch button should be the submit button. I
>>> even tried to tingle with the tabindex. I mean, on the form_load it
>>> should be easy enough to state this.
>>>
>>> But since I am fairly new to client scripting I couldn't make that work
>>> either. I tried something like this:
>>> <script language =vbscript>
>>> Sub Search
>>>
>>> if window.event.keyCode=13 then
>>>
>>> event.returnvalue=False
>>>
>>> event.cancel=True
>>>
>>> endif
>>>
>>> end sub
>>>
>>> </script>
>>>
>>> I only get a page error.
>>>
>>> Regards
>>> Bjorn
>>>
>>> "OHM" <news.microsoft.com> wrote in message
>>> news:u7oFp%(E-Mail Removed)...
>>>> This needs to be done on the client side using script langauge. You
>>>> need to trap the onkeydown event of the body tag.
>>>>
>>>> --
>>>>
>>>> Best Regards - OHM
>>>>
>>>> http://TrainingOn.net
>>>> --------------------------------------------------
>>>>
>>>>
>>>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Yes, I have been thinking of trapping the enter key (ascii 13), but
>>>>> this has to be done in the asp:textbox (I think), and I am not sure
>>>>> how to do this. Maybe in a page event, but which?
>>>>> I using VB, so I would be grateful for any code example in VB.
>>>>>
>>>>> Bjorn
>>>>>
>>>>> "Microsoft" <news.microsoft.com> wrote in message
>>>>> news:(E-Mail Removed)...
>>>>>> Yes, This will prevent any enter key submiting. However, you can
>>>>>> extend this to allow the one you want to submit.
>>>>>>
>>>>>> http://www.trainingon.net/Articles/Art147/Art147.html
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Best Regards - OHM
>>>>>>
>>>>>> http://TrainingOn.net
>>>>>> --------------------------------------------------
>>>>>>
>>>>>>
>>>>>> "Bjorn Sagbakken" <(E-Mail Removed)> wrote in message
>>>>>> news:(E-Mail Removed)...
>>>>>>> Hello.
>>>>>>>
>>>>>>> There maybe an simple answer to this, but sometimes one get a
>>>>>>> strange blindness when working intensely on one single problem.
>>>>>>>
>>>>>>> I'm using ASP.NET 2003, building pages that include 3 user controls
>>>>>>> (banner, top-menu and sub-menu). The top-menu contains like five
>>>>>>> asp:buttons.
>>>>>>>
>>>>>>> Further down the form there is search field with another asp:button.
>>>>>>> And I naturally want this button to act as submit button in the
>>>>>>> sense that when the user push the [enter] button in the search
>>>>>>> field. Well, this doesn't happen. The first (left) button on the
>>>>>>> usercontol top-menu fires, whitch brings the user to completely
>>>>>>> different page (whitch is the intention when the user actually
>>>>>>> clicks this button)
>>>>>>>
>>>>>>> I have tried to add another form tag for this, but no thank you,
>>>>>>> only one server side form tag, please!
>>>>>>>
>>>>>>> I have tried various ugly workarounds, like passing session
>>>>>>> variables so that the button in the top-menu actually clicks back on
>>>>>>> the other button. No luck.
>>>>>>>
>>>>>>> Anyone with an idea on how to pick whitch button that will act as
>>>>>>> submit button, when usercontrols with buttons are included?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>> Bjorn
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Whitch 1 next? Jimmy Jimmy MCSE 74 03-22-2006 10:09 PM
Whitch rows modified M.Fatih AKTAÇ ASP .Net 1 01-10-2006 06:49 PM
Re: Making a table cell act like a submit button? C.F. ASP .Net 0 04-13-2005 07:49 PM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM



Advertisments