Page_Load when using OnClientClick

R

Ra Carter

i have a standard html button in my ascx control in asp.net 2.0 using
this syntax:

<input type="button" onclick="javascript:somefunction()"; />

for some reason clicking this button causes a server side event
(OnInit for example) with IsPostBack == false. i also tried using this
syntax to create the button:

<asp:Button ID="x" runat="server" CssClass="viewbutton"
OnClientClick="somefunction()" UseSubmitBehavior="false"/>

this also causes the server side event. my questions are:

1. why does server side code run when clicking this button
2. why is IsPostBack equal to false?
3. how do i prevent the server side events?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top