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

How to add or remove event of ASP.Net control at runtime?

Hi,

How can I add or remove event of ASP.Net control at runtime, not in Page_Load? I want to click on a button for add or remove the event of another control.

Thanks
Sep 28 '07 #1
3 8564
Shashi Sadasivan
1,435 Expert 1GB
Hi,

How can I add or remove event of ASP.Net control at runtime, not in Page_Load? I want to click on a button for add or remove the event of another control.

Thanks
use the - operator to remove the operator

so
Expand|Select|Wrap|Line Numbers
  1. btn1.Click -= bt1.On_Click;
cheers
Sep 28 '07 #2
I don't understand, please you show in an example. For me, I try this already, but it can't remove the event.

protected void btnRemove_Click(object sender, EventArgs e)
{
btnTest.Click -= new EventHandler(btnTest_Click);
}

Do you have any ideas of adding events?

Cheers,
Sep 28 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
I don't understand, please you show in an example. For me, I try this already, but it can't remove the event.

protected void btnRemove_Click(object sender, EventArgs e)
{
btnTest.Click -= new EventHandler(btnTest_Click);
}

Do you have any ideas of adding events?

Cheers,
thats what you want
Expand|Select|Wrap|Line Numbers
  1. btnTest.Click -= btnTest_Click;
to add an event handler
Expand|Select|Wrap|Line Numbers
  1. btnTest.Click += new EventHandler(btnTest_Click);
cheers
Sep 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jordan | last post by:
I need to dynamically add an ImageButton control to a user control and and do some server-side processing when the user clicks it. While I the ImageButton is added to the user control at runtime,...
15
by: Amit D.Shinde | last post by:
I am adding a new picturebox control at runtime on the form How can i create click event handler for this control Amit Shinde
9
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new...
3
by: JohnR | last post by:
I have a form with a number of text boxes, comboboxes etc. What I would like to do is create an event handler for the "mouseenter" event for each of the controls whereby I display information...
2
by: Developer_Software | last post by:
Thanks in advance to anyone who can help :) I've got a placeholder control WITHIN A USER CONTROL that has its contents dynamically added and removed at runtime by a regular .aspx page. At...
6
by: AG | last post by:
I have a gridview with a template column containing an imagebutton to delete the row. Under some condition I don't want the row to be deleted, so would like to remove the button. In the...
2
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about...
1
by: amitsaxena1981 | last post by:
Hi, i am using asp.net with vb.net and creating the user control right now i am creating the user control at runtime. my user control generate the table at runtime and each column of table...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.