Which event will be called ? How the flow goes... ?

G

Gill Smith

My platform is .Net 1.1(ASP.Net)

for a button I have the following code

1. In the page load I am injecting the client script as follows
MyButton.Attributes.Add("onClick", "CallingJavaFunction")
Where "CallingJavaFunction" is the name of the Java function.

2. also for the clicked event I have the code as follows.

Private Sub MyButton_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles MyButton.Click

'Do some work here

End Sub

Which sequence the code will be called ? Thanks for your advice. Pointing
to any resource which explains this will be of great help.
-Gill
 
J

Jeff Tolman

Hi Gill,

The Page_Load event will ALWAYS be called every time the page is accessed.
You can test whether it's not a postback (i.e. the first time the page is
accessed) by:

If Not IsPostback Then
...Do Stuff here only for the first time the page is accessed
End If

THEN----if the button was clicked will the Click event be called.

Hope this helps.

Jeff Tolman
(e-mail address removed)
 
S

Saravana [MVP]

By doing this,
MyButton.Attributes.Add("onClick", "CallingJavaFunction")
You are attaching client side onclick event. So when the button is presses,
first client side event will be fired. Then it will come to server, where
you "MyButton_Click" event will fire.
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top