avoid javascript-doPostBack() in

Posted on 2011-09-26
Last Modified: 2012-06-21
HOw to avoid a java script:do postback when click ing any link on a web site.
Urgent solution required.
Question by:Ammar Iqbal
LVL 51

Expert Comment

ID: 36645417
post some code...
LVL 51

Expert Comment

ID: 36645488
use regular html element, for example:

<a href="..."><img src="..."></a>
LVL 51

Expert Comment

ID: 36645790
or a button with js

<button onClick="someJSFunction()">Do something</button>
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.


Author Comment

by:Ammar Iqbal
ID: 36703696
I am using  as

Protected Sub LinkButton15_Click(ByVal sender As Object, ByVal e AS EventArgs) Handles LnikButton15.Click
End Sub

this is one libk. When I bring mouse over the menu, ("Seminae_Forside.aspx) to traverse this link, i get  "javascript-doPostBack():ctlButtonLinkButton14". and it is taking much ,much time to do so.

How to solve his?
Urgently need help

LVL 17

Accepted Solution

sonawanekiran earned 500 total points
ID: 36707540
1) Add attributes to link in page_load method
  LinkButton15.Attributes.Add("onClick", "return DonotPostback();")

2) Add below script in head tag
function DonotPostback()
   return false;
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36707746
If you using link button, use following code;

<asp:LinkButton id="LinkButton15" Text="Submit"
  PostBackUrl="Seminae_Forside.aspx" runat="Server" />

LVL 51

Expert Comment

ID: 36710711
make it simple, use a link instead

<a href="Seminae_Forside.aspx">Forside</a>

and remove all the code...

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question