473,289 Members | 2,087 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,289 software developers and data experts.

how to avoid post-back on button (web control) click in asp.net 2.0?

Hi All,

I have a web page where I would like to do certain activities when user
click's a button.
I have used button web control on my page. Each time, I click this
button....page gets posted.
I don't want my page to do "post-back" when i click on button web
control.
is there any way to accomplish this?
Can anyone help me in this regard?

thanks

May 20 '06 #1
7 9972
"loga123" <vd**********@covansys.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I have a web page where I would like to do certain activities when user
click's a button.
I have used button web control on my page. Each time, I click this
button....page gets posted.
I don't want my page to do "post-back" when i click on button web
control.
is there any way to accomplish this?
Can anyone help me in this regard?


If you don't want your button to postback, that is presumably because it can
achieve everything it needs to do client-side i.e. with JavaScript...?

In which case, don't use an <asp:Button> control at all - simply use an HTML
button e.g.

<input type=button id=cmdHello value="Hello" onclick="alert('Hello');">
May 20 '06 #2
write your code like thisin Page_load()
if(!Page.IsPostBack)
{

your code

}
"loga123" <vd**********@covansys.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Hi All,

I have a web page where I would like to do certain activities when user
click's a button.
I have used button web control on my page. Each time, I click this
button....page gets posted.
I don't want my page to do "post-back" when i click on button web
control.
is there any way to accomplish this?
Can anyone help me in this regard?

thanks

May 20 '06 #3
You need to use javascript. Check the following
atlas.asp.net

Tasos

May 20 '06 #4
The HTML section in the toolsbox contains plain HTML controls including your
button.
No postbacks..
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> schreef in bericht
news:eg**************@TK2MSFTNGP02.phx.gbl...
"loga123" <vd**********@covansys.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I have a web page where I would like to do certain activities when user
click's a button.
I have used button web control on my page. Each time, I click this
button....page gets posted.
I don't want my page to do "post-back" when i click on button web
control.
is there any way to accomplish this?
Can anyone help me in this regard?


If you don't want your button to postback, that is presumably because it
can achieve everything it needs to do client-side i.e. with JavaScript...?

In which case, don't use an <asp:Button> control at all - simply use an
HTML button e.g.

<input type=button id=cmdHello value="Hello" onclick="alert('Hello');">

May 20 '06 #5
Are you wanting to post to a different page? If so, there is a
property on the button where you can specify where to post to. If you
are looking for something like javascript, you can use the HTML input,
or put onclick attribute as the javascript you want to do, followed by
"return false;" and i believe that will work for you.

HTH,
Darren Kopp

May 21 '06 #6
That doesn't prevent a post-back. It only prevents the code to be
executed when the post-back happens.

Ankit Aneja wrote:
write your code like thisin Page_load()
if(!Page.IsPostBack)
{

your code

}
"loga123" <vd**********@covansys.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Hi All,

I have a web page where I would like to do certain activities when user
click's a button.
I have used button web control on my page. Each time, I click this
button....page gets posted.
I don't want my page to do "post-back" when i click on button web
control.
is there any way to accomplish this?
Can anyone help me in this regard?

thanks


May 21 '06 #7
"Ankit Aneja" <ef*****@newsgroups.nospam> wrote in message
news:uO**************@TK2MSFTNGP02.phx.gbl...
write your code like thisin Page_load()

if(!Page.IsPostBack)
{

your code

}


How would that stop a postback...?
May 21 '06 #8

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

Similar topics

4
by: Jake Lloyd | last post by:
In "A Note on Security In PHP" (partly in reference to a security flaw that exists or recently did exist in phpBB) at http://nl3.php.net/security-note.php The PHP Group makes this claim: "Every...
22
by: T.S.Negi | last post by:
Hi All, I want to avoid using cursors and loops in stored procedures. Please suggest alternate solutions with example (if possible). Any suggestion in these regards will be appreciated. ...
9
by: iaesun | last post by:
i'm trying to write a batch that will perform a complex task using set-based selects instead of a row-based cursor. let me know if you can help me figure out how. description of what i'm trying...
3
by: Thomas Müller-Lynch | last post by:
How can I avoid late binding with the directive strict = tru My ASP .net-file looks like this <%@DEBUG=true TRACE=true Strict=false EXPLICIT=true% .. dim footerValues as Arra footerValues =...
19
by: Charles Law | last post by:
Take a solution with a project hierarchy along the lines of an n-tier system, so that we have a data layer, business layer and presentation layer. The presentation layer is coupled to the business...
32
by: KK | last post by:
Hello all, I have a unsigned char buffer 'buffer' and I need to convert the first 12 bytes of it into a string. Below is a code that should work, however, how can I avoid reinterpret_cast...
10
by: Noozer | last post by:
I'm writing an ASP application and have a noob question... I have a class that access an MS SQL database. I have another class also accesses an MS SQL database and this second class uses objects...
4
by: gzaxar | last post by:
Hi to all in forum. It is my first post here. I am quite new in MsAccess programming. Here is a problem which i am facing to. I want to keep records of employees CV's. More specifically i want...
3
by: Cirene | last post by:
Building an ASP.NET community site where people can post ads, messages, etc... Based on your experience do you have any suggestions on how to avoid spammers (at least deter them)? Ex: Should...
1
by: nguillot | last post by:
Hello. If I have the following classes: class B {}; typedef B tB; if A is: class A
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.