Solved

avoid javascript-doPostBack() in asp.net

Posted on 2011-09-26
7
342 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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