By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,114 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,114 IT Pros & Developers. It's quick & easy.

Event Bubbling From The HeaderTemplate

P: n/a
I have three LinkButtons in the HeaderTemplate of my DataList (I use them to
let the user determine what to sort the list by). I am assuming that the
event will be bubbled to the ItemCommand event (since that is the default
and I did not supply a CommandName). However, I need to determine which of
the three LinkButtons triggered the event. How can I do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
It's the 'sender' parameter in the event handler.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have three LinkButtons in the HeaderTemplate of my DataList (I use
them to let the user determine what to sort the list by). I am
assuming that the event will be bubbled to the ItemCommand event
(since that is the default and I did not supply a CommandName).
However, I need to determine which of the three LinkButtons triggered
the event. How can I do this? Thanks.

Nov 19 '05 #2

P: n/a
Sorry to burst your Event Bubble, but that is incorrect. First of all, the
ItemCommand uses "source", not "sender". Second, the value of "source" will
always be the DataList that the event was bubbled from, not the control that
triggered the event. One thing that I noticed, I haven't had time to look
into it yet, but while I was testing some other code of mine that uses event
bubbling, I noticed that in the Trace information there is a value (I don't
know if it's a variable or not) called __EVENTTARGET which has the value of
the control which triggered the event bubbling. If Trace can get at this
value, I was wondering if there might be a way to get at it through some
kind of system variable? If anyone knows anything about this, I would like
to know. Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8**************************@msnews.microsoft .com...
It's the 'sender' parameter in the event handler.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have three LinkButtons in the HeaderTemplate of my DataList (I use
them to let the user determine what to sort the list by). I am
assuming that the event will be bubbled to the ItemCommand event
(since that is the default and I did not supply a CommandName).
However, I need to determine which of the three LinkButtons triggered
the event. How can I do this? Thanks.


Nov 19 '05 #3

P: n/a
Nathan Sokalski wrote:
I have three LinkButtons in the HeaderTemplate of my DataList (I use them to
let the user determine what to sort the list by). I am assuming that the
event will be bubbled to the ItemCommand event (since that is the default
and I did not supply a CommandName). However, I need to determine which of
the three LinkButtons triggered the event. How can I do this? Thanks.


Can't you set the ItemCommand for the LinkButtons? This will still
raise the DataList's ItemCommand event, and you can do:

If e.CommandName = "..." Then
...
ElseIf e.CommandName = "..." Then
...
ElseIf e.CommandName = "..." Then
...
End If
Where "..." is the ItemCommand values for the various LinkButtons.

--

Scott Mitchell [ASP.NET MVP]
mi******@4GuysFromRolla.com
http://www.4GuysFromRolla.com/ScottMitchell
Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.