473,770 Members | 5,880 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event Bubbling From The HeaderTemplate

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********@hotm ail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
3 1309
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
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********@hotm ail.com
http://www.nathansokalski.com/

"Brock Allen" <ba****@NOSPAMd evelop.com> wrote in message
news:b8******** *************** ***@msnews.micr osoft.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
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******@4GuysF romRolla.com
http://www.4GuysFromRolla.com/ScottMitchell
Nov 19 '05 #4

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

Similar topics

1
1403
by: john | last post by:
I1. notice that if you have an onclick event for both the document and for a particular element, the onclick for the element is called first and then it bubbles up to the one for the document. Is it possible to have an onclick event that is at the document level that is called first? I would like to intercept it there and return false so that it doesn't bubble down to the element level. 2. On a completely unrelated topic, is it possible...
4
1957
by: Wee Bubba | last post by:
the following event handler checks to see if any parent control has attached to the event 'SearchItemSelect'. i use it for event bubbling whenever one of my search items has been selected and at the moment i am calling this from a repeater's ItemCommand event handler: protected void OnSearchItemSelect(EventArgs e) { if (SearchItemSelect != null) { SearchItemSelect (this, e);
0
1119
by: Paul Perot | last post by:
Hi All: I have an application in ASP.NET using VB.NET where I would like to process a number of JPEGs. I have a simple button that starts the process going, an image control, and some code behind. What the code does is to look in a sub-directory for the JPEGs, once it finds one it displays it in the image control. The code behind manipulates some of the metadata properties of the JPEG. When that is complete it goes to the next JPEG...
7
2146
by: comzy | last post by:
I have created an event bubbling for my pager control which is used for implementing paging in data grid. Althoug it worked very fine in .NET 1.1 it is throwing the following error after i migrated it to .NET 2.0 The peculiar thing abou that is it is throwing error only in IE 6.0 and it works fine in netscape, firefox, opera even after converting it to ..NET 2.0 Can anyone tell me whether anything has changed in event bubbling format...
0
1351
by: Peter Rilling | last post by:
Hi. Okay, I have read only other news postings that winforms to not support the concept of "event bubbling" that web apps do. Nevertheless, I need to implement something such that if I have a usercontrol which has other usercontrols which has other controls, I would like to look an event up at the highest usercontrol that can intercept clicks for any of the nested controls. Has anyone worked on a library to support this? Are there any...
0
1008
by: Nathan Sokalski | last post by:
I am using a DataList with Event Bubbling. When I bubble an event, the ItemCommand event is always called before the bubble event specified in the CommandName property. Is this ASP.NET's way of making ItemCommand the default bubble event, or is there another reason for it? I always thought the purpose of ItemCommand was to use for a purpose other than cancelling, deleting, editing, or updating an item, but it does not seem like that was...
2
1771
by: Rasmus Kromann-Larsen | last post by:
Hey, Messing with JavaScript on a webpage, I ran into a small problem. Wanting to have a table cell select it's contained radiobutton in a rather non-specific way, I wrote the following JavaScript: function click_it(element) { var x = element.childNodes
3
1308
by: connectwithme | last post by:
I am using the IE 6.x & Firefox 2.x I am trying the event bubbling concept. Herez the code <html> <head> <script> function call_function(evt) { .........some_code_here.......} </script>
2
1672
by: alhalayqa | last post by:
hi, in MSIE, you can attach onclick event to both anchor and document objects. here is some code : document.onclick = function() {alert('document clicked ...'); } <a href= " " onclick="clickHandler"></a>
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10232
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8891
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.