Solved

avoid javascript-doPostBack() in asp.net

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

Expert Comment

by:HainKurt
ID: 36645417
post some code...
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 36645488
use regular html element, for example:

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

Expert Comment

by:HainKurt
ID: 36645790
or a button with js

<button onClick="someJSFunction()">Do something</button>
0
3 Use Cases for Connected Systems

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

 
LVL 1

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
  Response.Redirect("Seminae_Forside.aspx")
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

0
 
LVL 17

Accepted Solution

by:
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
<script>
function DonotPostback()
{
   return false;
}
<script>
0
 
LVL 12

Expert Comment

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

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

Regards,
Ram
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 36710711
make it simple, use a link instead

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

and remove all the code...
0

Featured Post

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now