Solved

avoid javascript-doPostBack() in asp.net

Posted on 2011-09-26
7
351 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

776 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