473,396 Members | 2,081 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.

Firing events?

I have a webform with an Image Button on it and an attached event handler
for a Click event.

I have the same on another page.

This click event for the first one doesn't work - you click on it and it
doesn't even attempt to postback.

The second one does.

The code between the two pages seems the same however when I view source on
the second one I get all of the web/ui/ javascript functionality but not on
the first.

Is there a switch or something I could be missing?

Many thanks

Jof
Nov 17 '05 #1
4 918
Check the HTML code and ensure both buttons are nested in the <form> tag. If
not, you will not get a postback for the button outside.

Second, make sure you have the handler set up. For some strange reason, esp
with Visual Studio .NET, the handlers are lost. I have only had this happen,
thus far, in Visual Basic .NET. The handler will be something like:

Protected Sub Button1_Click(sender As Object, e As EventArgs)

It needs to be like:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click

For C#, the handler is like:

Button1.Click += new EventHandler(this.Button1_Click);

Once you link the handler set up, everything works fine.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
<Jof> wrote in message news:ez**************@TK2MSFTNGP09.phx.gbl...
I have a webform with an Image Button on it and an attached event handler
for a Click event.

I have the same on another page.

This click event for the first one doesn't work - you click on it and it
doesn't even attempt to postback.

The second one does.

The code between the two pages seems the same however when I view source on the second one I get all of the web/ui/ javascript functionality but not on the first.

Is there a switch or something I could be missing?

Many thanks

Jof

Nov 17 '05 #2
Just try removing the image button for which the event
does not work, and add it again. Don't waste time in these
matters buddy!

Sunil TG
-----Original Message-----
I've checked its inside a form (running) at server.

On the InitializeComponent function I have
this.ImageButton1.Click += new
System.Web.UI.ImageClickEventHandler (this.ImageButton1_Click);
As you suggest but it still doesn't want to work. Any other ideas?
Jof
.

Nov 17 '05 #3
Tried that already...but....

the solution is overlapping forms.

on my page I had a server control with its own form and they were
overlapping.

Solution solved! Thanks for the help though!

"Sunil TG [MVP]" <su*****@microsoft.com> wrote in message
news:0b****************************@phx.gbl...
Just try removing the image button for which the event
does not work, and add it again. Don't waste time in these
matters buddy!

Sunil TG
-----Original Message-----
I've checked its inside a form (running) at server.

On the InitializeComponent function I have
this.ImageButton1.Click += new
System.Web.UI.ImageClickEventHandler

(this.ImageButton1_Click);

As you suggest but it still doesn't want to work. Any

other ideas?

Jof
.

Nov 17 '05 #4
Hi,

could we take a look at your codes for the first button, both the UI and the
implementation part of it

--
Thank you very much

Warmest Regards,
Softwaremaker (WilliamT)
Software Architect
+++++++++++++++++++
<Jof> wrote in message news:ez**************@TK2MSFTNGP09.phx.gbl...
I have a webform with an Image Button on it and an attached event handler
for a Click event.

I have the same on another page.

This click event for the first one doesn't work - you click on it and it
doesn't even attempt to postback.

The second one does.

The code between the two pages seems the same however when I view source on the second one I get all of the web/ui/ javascript functionality but not on the first.

Is there a switch or something I could be missing?

Many thanks

Jof

Nov 17 '05 #5

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

Similar topics

3
by: Mike | last post by:
Hi, I am adding controls dynamically in a WebForm, but none of these controls' events fire. Here is the class code I am using. I have tried so many things, but nothing works :-( namespace...
7
by: Denise | last post by:
I just realized the DataTable_RowChanging events were firing when I called Fill method of the DataAdapter! It fires TWICE for each row loaded. I thought these were only supposed to be called when...
4
by: Woody Splawn | last post by:
I had it happen again today that I needed some code to run upon loading the form but the code that I needed to have run needed to run AFTER all the rest of Visual Studio's events had fired. Due to...
28
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
19
by: furiousmojo | last post by:
This is a strange problem. I have a project where the contents of global.asax application_error are not firing. It is an asp.net 2.0 application using web application projects. I have another...
5
by: Joe | last post by:
Hi I am adding a class to a ComboBox - and all is fine except that I fill the combobox on the Form_Load Method and it causes the method private void comboBox2_SelectedIndexChanged(object...
0
by: RobKinney1 | last post by:
Hello, One of our C# apps (2.0) depends on a few events. One of them being DocumentComplete. Well, everything works fine with users that have IE 6 installed on their computers. But we noticed...
2
by: mswlogo | last post by:
I looked high and low for code to do this and finally found some VB code that did it right. This is a C# flavor of it. public event EventHandler<EventArgsMyEventToBeFired; public void...
1
by: TimmyTurner | last post by:
Hi all I'm working on a ASP.NET, C# project on Visual Studio 2005, using a MSDB in _vista_. My problem is that the events for the buttons are not firing. I've searched the web and the solution...
4
by: Joergen Bech | last post by:
I sometimes use delegates for broadcasting "StateChanged" events, i.e. if I have multiple forms and/or controls that need updating at the same time as the result of a change in a global/common...
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: 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
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...
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.