Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Event Bubbling From The HeaderTemplate

Reply
Thread Tools

Event Bubbling From The HeaderTemplate

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-21-2005
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

http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      09-22-2005
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.
>



 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      09-23-2005
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

http://www.nathansokalski.com/

"Brock Allen" <> wrote in message
news: .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.
>>

>
>



 
Reply With Quote
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      09-23-2005
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]

http://www.4GuysFromRolla.com/ScottMitchell
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net Web Controls 0 05-29-2006 07:16 AM
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net 0 05-29-2006 07:16 AM
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net Datagrid Control 0 05-29-2006 07:16 AM
Event Bubbling From The HeaderTemplate Nathan Sokalski ASP .Net 3 09-23-2005 04:03 AM
Event Bubbling From The HeaderTemplate Nathan Sokalski ASP .Net Datagrid Control 3 09-23-2005 04:03 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57