473,398 Members | 2,393 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,398 software developers and data experts.

Generating event handler at run time.

mg
The following code runs without error, but the 'alert' does not appear. Can
you
see the problem?
private void LinkButton1_Click(object sender, System.EventArgs e)
{
System.Web.UI.WebControls.ImageButton ImageButton1 = new ImageButton();
ImageButton1.Height = 18;
ImageButton1.Width = 100;
ImageButton1.ImageUrl = @"\images\continue.gif";
Panel1.Controls.Add(ImageButton1);
ImageButton1.Click += new ImageClickEventHandler(ImageButton1_Click);
}
private void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Write("<script language='javascript'>alert('TEST');</script>");
}
Nov 18 '05 #1
1 1103
mg
That is, the 'alert' does not appear when the ImageButton is clicked.

"mg" wrote:
The following code runs without error, but the 'alert' does not appear. Can
you
see the problem?
private void LinkButton1_Click(object sender, System.EventArgs e)
{
System.Web.UI.WebControls.ImageButton ImageButton1 = new ImageButton();
ImageButton1.Height = 18;
ImageButton1.Width = 100;
ImageButton1.ImageUrl = @"\images\continue.gif";
Panel1.Controls.Add(ImageButton1);
ImageButton1.Click += new ImageClickEventHandler(ImageButton1_Click);
}
private void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Write("<script language='javascript'>alert('TEST');</script>");
}

Nov 18 '05 #2

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

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
18
by: Elder Hyde | last post by:
Hey all, A class of mine needs to tell the outside world when its buffer is not empty. The problem is that C# seems to force you to put the event-raising code in the base class. To illustrate,...
3
by: mg | last post by:
The following code runs without error, but the alert does not appear. Can you see the problem? private void LinkButton1_Click(object sender, System.EventArgs e) {...
4
by: Lee Chapman | last post by:
Hi, I am having difficulty getting the ASP.NET framework to generate valid XHTML. My immediate problem surrounds user input in, for example, textbox controls. I consider characters such as...
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
6
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
2
by: Gary Brown | last post by:
Hi, I dynamically connect a MDI parent's toolstrip button to a child event handler by calling the following member at the child's Activated and Deactivate events. It looks simple enough but...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
5
by: dwmartin18 | last post by:
Hello everyone. I have quite the puzzling problem with a script I have been working on lately. I have created a function that can be called to create a new html element (e.g. input, select, div,...
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
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
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
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...
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
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...

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.