473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

__Click event

All,

I have a ASPX page that handles a click event of a button and also have a
code behind for the button - I would like to handle the click event of the
webform first and then execute the code in the codebehind for the button is
this possible?

Thanks
Msuk
Nov 18 '05 #1
2 923
That's a fairly common scenario. Try this?

Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", _
"alert('Client side click');return true;")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Handled the server event at " & _
Now.ToLongTimeString
End Sub

<p>
<asp:button id="Button1" runat="server"
Text="Button"></asp:button></p>
<p>
<asp:label id="Label1" runat="server">Label</asp:label></p>

Ken
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com...
All,

I have a ASPX page that handles a click event of a button and also have a
code behind for the button - I would like to handle the click event of the
webform first and then execute the code in the codebehind for the button
is
this possible?

Thanks
Msuk


Nov 18 '05 #2
I think Ken didn't answer the question which was about if we could fire the
event in the codebehind first then fire the client side event.
I have the same question. I was excited first. But I after read and test the
code. It didn't work the way we want.

Thanks
David
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
That's a fairly common scenario. Try this?

Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", _
"alert('Client side click');return true;")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Handled the server event at " & _
Now.ToLongTimeString
End Sub

<p>
<asp:button id="Button1" runat="server"
Text="Button"></asp:button></p>
<p>
<asp:label id="Label1" runat="server">Label</asp:label></p>

Ken
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com...
All,

I have a ASPX page that handles a click event of a button and also have a
code behind for the button - I would like to handle the click event of
the
webform first and then execute the code in the codebehind for the button
is
this possible?

Thanks
Msuk

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy Read | last post by:
Hello all, I have the requirement to produce source code that produces an object hierarchy. Example: Root | Folder 1
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
12
by: Jack Russell | last post by:
My unstanding of all VB up to and including vb6 is that an event could not "interrupt" itself. For instance if you had a timer event containing a msgbox then you would only get one message. ...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
19
by: Daniela Roman | last post by:
Hello, I try to fire an event under a button click event and maybe anybody can give a clue please. I have let's say a WEB grid with PageIndexChanged event: private void...
5
by: jaysonnward | last post by:
Hello All: I've recently been recreating some 'dropdown menus' for a website I manage. I'm writing all my event handlers into my .js file. I've got the coding to work in Firefox, but the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.