Connecting Tech Pros Worldwide Forums | Help | Site Map

capturing user events

PJ6
Guest
 
Posts: n/a
#1: Nov 19 '05
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




Eliyahu Goldin
Guest
 
Posts: n/a
#2: Nov 19 '05

re: capturing user events


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

Eliyahu

"PJ6" <nobody@nowhere.net> wrote in message
news:uL82RzypFHA.1464@TK2MSFTNGP14.phx.gbl...[color=blue]
> 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
>
>
>[/color]


PJ6
Guest
 
Posts: n/a
#3: Nov 19 '05

re: capturing user events


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

Paul

"Eliyahu Goldin" <removemeegoldin@monarchmed.com> wrote in message
news:%23XOkk4ypFHA.2156@TK2MSFTNGP14.phx.gbl...[color=blue]
> Attributes collection is for client-side attributes. You are adding a
> reference to a server-side method.
>
> Eliyahu
>
> "PJ6" <nobody@nowhere.net> wrote in message
> news:uL82RzypFHA.1464@TK2MSFTNGP14.phx.gbl...[color=green]
>> 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
>>
>>
>>[/color]
>
>[/color]


Lucas Tam
Guest
 
Posts: n/a
#4: Nov 19 '05

re: capturing user events


"PJ6" <nobody@nowhere.net> wrote in
news:OduGB7ypFHA.2116@TK2MSFTNGP14.phx.gbl:
[color=blue]
> Um, OK. So how do get the control to be able to detect its own click
> event and call a server-side method?[/color]

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

--
Lucas Tam (REMOVEnntp@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Closed Thread