capturing user events

P

PJ6

I'm apparently not understanding something. I want to capture some user
events in a web control I'm inheriting from, such as a table cell or a
button. The code below doesn't work, the attributes aren't even rendered.
I'm sure I'm not calling the sub right, either. Can someone clue me in?

Paul

Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
Attributes.Add("onMouseOut", "TEST")
Attributes.Add("onClick", "TEST")
MyBase.OnPreRender(e)
End Sub

Public Sub TEST()
Me.BackColor = System.Drawing.Color.FromArgb(100, 100, 100)
End Sub
 
P

PJ6

Um, OK. So how do get the control to be able to detect its own click event
and call a server-side method?

Paul
 
E

Eliyahu Goldin

Attributes collection is for client-side attributes. You are adding a
reference to a server-side method.

Eliyahu
 
L

Lucas Tam

Um, OK. So how do get the control to be able to detect its own click
event and call a server-side method?

First I suggest you read up on server side program so you understand the
difference between client side and server side events.

But to do what you wanted, you have a couple of options:

1. Postback to server to handle button events (standard ASP.NET way)

2. Use Javascript remoting or similiar (to simulate what you want to do).
Take a look at Dart Live controls or javascript remoting

3. Client side postbacks - ASP.NET 2.0
 

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,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top