473,396 Members | 1,734 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,396 software developers and data experts.

Control Event

Hello,

I created a User Control (.ascx) in my web site.
Inside this control I have a linkbutton.

I want to fire an event when this linkbutton is clicked so that I can
access that event on the page's code where my user controls is added.

How can I do this?

Thanks,
Miguel

May 30 '07 #1
3 1213
First you declare a public event within your control such as this example:

Public Event LinkClicked()

Then you raise the event from within your code such as in this example:
RaiseEvent LinkClicked()

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"shapper" <md*****@gmail.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
Hello,

I created a User Control (.ascx) in my web site.
Inside this control I have a linkbutton.

I want to fire an event when this linkbutton is clicked so that I can
access that event on the page's code where my user controls is added.

How can I do this?

Thanks,
Miguel
May 30 '07 #2
On May 30, 8:42 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
<S...@Orr.netwrote:
First you declare a public event within your control such as this example:

Public Event LinkClicked()

Then you raise the event from within your code such as in this example:
RaiseEvent LinkClicked()

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net

"shapper" <mdmo...@gmail.comwrote in message

news:11**********************@u30g2000hsc.googlegr oups.com...
Hello,
I created a User Control (.ascx) in my web site.
Inside this control I have a linkbutton.
I want to fire an event when this linkbutton is clicked so that I can
access that event on the page's code where my user controls is added.
How can I do this?
Thanks,
Miguel
Can I raise the event and send a few parameters?

Thanks,
Miguel

May 30 '07 #3
Yes you can.

Public Event LinkClicked(MyParm as String, ID as Byte)

RaiseEvent LinkClicked(MyString, MyID)

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"shapper" <md*****@gmail.comwrote in message
news:11*********************@o5g2000hsb.googlegrou ps.com...
On May 30, 8:42 pm, "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]"
<S...@Orr.netwrote:
>First you declare a public event within your control such as this
example:

Public Event LinkClicked()

Then you raise the event from within your code such as in this example:
RaiseEvent LinkClicked()

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net

"shapper" <mdmo...@gmail.comwrote in message

news:11**********************@u30g2000hsc.googleg roups.com...
Hello,
I created a User Control (.ascx) in my web site.
Inside this control I have a linkbutton.
I want to fire an event when this linkbutton is clicked so that I can
access that event on the page's code where my user controls is added.
How can I do this?
Thanks,
Miguel

Can I raise the event and send a few parameters?

Thanks,
Miguel
May 31 '07 #4

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

Similar topics

9
by: Lance Johnson | last post by:
I would like for when a tab page changes, that my controls on the previous tab page would receive a visiblechanged event or some other event so they are aware of that. We have db locks in some of...
7
by: Colin Young | last post by:
I have a UserControl that contains a calendar control. The calendar is not raising events (month navigation, date selections, etc.). I've checked that the OnSelectionChanged event has a handler...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
5
by: George Durzi | last post by:
I have a simple user control with a text box and a submit button. When the user enters some text into the textbox and clicks the submit button, a record is created in the database. I'm using...
4
by: thomson | last post by:
Hi all, i do have a user control with 4 buttons, and all the events are firing properly, My problem is that i need to right an event handler in the user control, which gets fired after a...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
5
by: Doug Handler | last post by:
Hi, I have a form (Form1) that contains a tab control which one tab has a customer user control (UserControl1). When the user double-clicks on the grid hosted there a new user control is...
1
by: Sylvie | last post by:
I have an Aspx page (Name:"PG") (Contains "UC") and an Ascx Usercontrol (Name:"UC") (Contains "AspxGrid1") I wanna expose Aspxgrid1.rowchanged event to Aspx Page, when user vhanges or...
1
by: Jordan S. | last post by:
I'm just wondering if this would work. Please note that I'm not asking *how* to raise events. I'm clear on that. What I'm not clear on is the sequence in which events are raised by custom controls...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...

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.