473,320 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

complex event bubbling problem

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);
}
}

i now want to call this from within a different function, NOT an event
handler. basically if the user's search returns only one hit I don't
want to display a repeater I just want to bubble an event up to the
mother page straight away. i tried this:

OnSearchItemSelect();

but i get the error message "No overload for method
'OnSearchItemSelect' takes '0' arguments. i realise that ive got to
pass it a variable of type 'e'. But what do I pass it as I am not
calling it from within a repeater's event handler anymore but just
from a general method? how can i overload my event?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 18 '05 #1
4 1929
Wes:

You can create the EventArgs instance yourself, i.e:

EventArgs e = new EventArgs();
OnSearchItemSelect(e);

or simply

OnSearchItemSelect(new EventArgs());

Since the EventArgs class does not have information (state) about the
event to pass along, this should work fine. Other event argument
objects contain information about the type of event and who the event
is coming from, but EventArgs is pretty braindead.

HTH,

--
Scott
http://www.OdeToCode.com

On 21 May 2004 10:25:54 -0500,
ma***********@yahoo-dot-com.no-spam.invalid (Wee Bubba) wrote:
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:


Nov 18 '05 #2
Does it basically make any difference if you treat it as an ordinary method
call? You could call it:

OnSearchItemSelect(EventArgs.Empty);

but certainly if you work with event bubbling as it really works, the type
of the event argument should be CommandEventArgs (in
System.Web.UI.WebControls) namespace. If it needs that, just instantiate
System.Web.UI.WebControls.CommandEventArgs with proper command event data
and pass it to the method.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Wee Bubba" <ma***********@yahoo-dot-com.no-spam.invalid> wrote in message
news:40********@127.0.0.1...
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);
}
}

i now want to call this from within a different function, NOT an event
handler. basically if the user's search returns only one hit I don't
want to display a repeater I just want to bubble an event up to the
mother page straight away. i tried this:

OnSearchItemSelect();

but i get the error message "No overload for method
'OnSearchItemSelect' takes '0' arguments. i realise that ive got to
pass it a variable of type 'e'. But what do I pass it as I am not
calling it from within a repeater's event handler anymore but just
from a general method? how can i overload my event?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Nov 18 '05 #3
thanks a lot scott. that worked a treat. ive been trying to work that
one out all day!!! nice one matey!!! :D
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 18 '05 #4
also scott, whilst i got ya, i posted another question about dataList
control ID's. i was wondering if you knew the answer to that one
too... :wink:
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 18 '05 #5

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

Similar topics

5
by: Mark Szlazak | last post by:
Apparently there is a textarea onscroll event bubbling bug in Firefox and Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=229089 I'm trying to check for this bug with the following...
0
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...
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
3
by: Nathan Sokalski | last post by:
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...
7
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...
4
by: Nathan Sokalski | last post by:
I have a DataList that has an Button as one of the controls in it's ItemTemplate. The Button has a CommandName="delete" attribute, but when I click it the DeleteCommand event doesn't even get...
17
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
1
by: Christian Sengstock | last post by:
Hi all, i have a js application with several event handlers which i manage via prototype .bindAsEventListener. On normal page navigation ( link navigation ) i finish all events handlers...
2
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= " " ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.