473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Buttons without PostBack

Hi

Is there a way to prevent an ASP-Button from performing a PostBack? I'ld
rather have a script controlling this behaviour.

Thanks, Urs
Nov 18 '05 #1
3 4257
Hi,

The following will prevent the postback:

[C#]
button1.Attributes["onclick"] = "javascript:SomeFunction();return false;";
[VB]
button1.Attributes("onclick") = "javascript:SomeFunction();return false;"

The client-side function specified will get executed and there will be no
postback.

Greetings
Martin
"Urs Vogel" <uv****@msn.com> wrote in message
news:#n**************@TK2MSFTNGP09.phx.gbl...
Hi

Is there a way to prevent an ASP-Button from performing a PostBack? I'ld
rather have a script controlling this behaviour.

Thanks, Urs

Nov 18 '05 #2
Thanks. Sure, could have had the same idea myself, sorry for bothering ..
"Martin Dechev" <de*******@hotmail.com> schrieb im Newsbeitrag
news:uH**************@TK2MSFTNGP14.phx.gbl...
Hi,

The following will prevent the postback:

[C#]
button1.Attributes["onclick"] = "javascript:SomeFunction();return false;";
[VB]
button1.Attributes("onclick") = "javascript:SomeFunction();return false;"

The client-side function specified will get executed and there will be no
postback.

Greetings
Martin
"Urs Vogel" <uv****@msn.com> wrote in message
news:#n**************@TK2MSFTNGP09.phx.gbl...
Hi

Is there a way to prevent an ASP-Button from performing a PostBack? I'ld
rather have a script controlling this behaviour.

Thanks, Urs


Nov 18 '05 #3
Hi,
Could you please give the sample code which I can copy/past into my test
project?

Thanks.

william
"Urs Vogel" wrote:
Thanks. Sure, could have had the same idea myself, sorry for bothering ..
"Martin Dechev" <de*******@hotmail.com> schrieb im Newsbeitrag
news:uH**************@TK2MSFTNGP14.phx.gbl...
Hi,

The following will prevent the postback:

[C#]
button1.Attributes["onclick"] = "javascript:SomeFunction();return false;";
[VB]
button1.Attributes("onclick") = "javascript:SomeFunction();return false;"

The client-side function specified will get executed and there will be no
postback.

Greetings
Martin
"Urs Vogel" <uv****@msn.com> wrote in message
news:#n**************@TK2MSFTNGP09.phx.gbl...
Hi

Is there a way to prevent an ASP-Button from performing a PostBack? I'ld
rather have a script controlling this behaviour.

Thanks, Urs



Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim Heavey | last post by:
I have 2 datalist each has 3 buttons in the datalist. One Datalist, only 2 of the three buttons work in the other one is dead (no postback, not nothing). I have another Datalist and on this...
1
by: andrei | last post by:
Hi Group, I have an aspx form with a variable number of buttons added dynamically, with id's like b01, b02, b03... Whenever I click one of these buttons, the form is posted back. I need to...
5
by: benoit | last post by:
I heve this webform with a checkboxlist and a button. Based on which checkboxes are checked, several textboxes and Buttons are generated. When I click one of these buttons, the page goes in...
2
by: Wayne Sepega | last post by:
I have the following Code: foreach (MyClass d in myClassCollection) { curRadioBtn = new RadioButton(); curRadioBtn.Text = d.ToString(); curRadioBtn.GroupName = "Contact"; curRadioBtn.ID =...
4
by: Morten Wennevik | last post by:
Hi I have a web page that contains a button doing some simple code. On the development machine this works as expected, but on the client machine, the button triggers a postback, but the events...
5
by: mayur_hirpara | last post by:
Hi, I have been developing web applications for a while now. However, as I was thinking through the architecture I really don't understand the "How server can identify between which buttons has...
6
by: Totto | last post by:
Hi, Anyone know the best solution to dynamically add buttons to a asp 2.0 page using data from Sql server? Are there any contols suitable for this or is it best to iterate the dataset and...
4
by: Blasting Cap | last post by:
I have a page that has a number of radio buttons that will be displayed to different access levels of a user who logs in to my website. For instance, if there are a dozen buttons, user1 will see...
2
by: Radu | last post by:
Hi. I have a page with the following html: __________________________________________________________ <h1>Dynamic Controls Test</h1> <hr /> <asp:TextBox ID="txtProduct1" Text="txtProduct 1"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.