• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

avoid javascript-doPostBack() in asp.net

HOw to avoid a java script:do postback when click ing any link on a asp.net web site.
Urgent solution required.
0
Ammar Iqbal
Asked:
Ammar Iqbal
1 Solution
 
HainKurtSr. System AnalystCommented:
post some code...
0
 
HainKurtSr. System AnalystCommented:
use regular html element, for example:

<a href="..."><img src="..."></a>
0
 
HainKurtSr. System AnalystCommented:
or a button with js

<button onClick="someJSFunction()">Do something</button>
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Ammar IqbalSenior IT Consultant/senior Software engineerAuthor Commented:
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
 
Kiran SonawaneProject LeadCommented:
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
 
Ramkisan JagtapLead DeveloperCommented:
Hi,
If you using link button, use following code;

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

Regards,
Ram
0
 
HainKurtSr. System AnalystCommented:
make it simple, use a link instead

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

and remove all the code...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now