473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HtmlInputImage. ServerClick

JP
ow do I get a HtmlInputImage to raise the ServerClick event

I have two inputs one is a submit button the other is a
image. The submit button works the input image does not.
Does anyone know why this would happen?

I would like to mention that I have overridden viewstate
and do not use server side forms.

Below is my code maybe I am missing something

<input type="image" src="~/img/btnPurchase.gif " width="90"
height="26" id="Purchase" runat="server">
<input type="submit" id="sbmt" runat="server"
value="submit">

and the code behind is as follows.

protected System.Web.UI.H tmlControls.Htm lInputImage
Purchase;
protected System.Web.UI.H tmlControls.Htm lInputButton sbmt;

private void InitializeCompo nent()
{
this.sbmt.Serve rClick += new System.EventHan dler
(this.Sbmt_Clic k);
this.Purchase.S erverClick += new
System.Web.UI.I mageClickEventH andler(this.Pur chase_Click);
this.Load += new System.EventHan dler
(this.Page_Load );
}

public void Purchase_Click( object sender,
System.Web.UI.I mageClickEventA rgs e)
{
Response.Write( "Purchase_C lick Fired!!!");
Response.End();
}
private void Sbmt_Click(obje ct sender, System.EventArg s e)
{
Response.Write( "Purchase_C lick Fired!!!");
Response.End();
}
Nov 17 '05 #1
5 2724
Please find my suggestion inlined with your code....

HTH
-----Original Message-----
ow do I get a HtmlInputImage to raise the ServerClick event
I have two inputs one is a submit button the other is a
image. The submit button works the input image does not.
Does anyone know why this would happen?

I would like to mention that I have overridden viewstate
and do not use server side forms.

Below is my code maybe I am missing something

<input type="image" src="~/img/btnPurchase.gif " width="90"height="26" id="Purchase" runat="server">
<input type="submit" id="sbmt" runat="server"
value="submit" >

and the code behind is as follows.

protected System.Web.UI.H tmlControls.Htm lInputImage
Purchase;
protected System.Web.UI.H tmlControls.Htm lInputButton sbmt;

private void InitializeCompo nent()
{
this.sbmt.Serve rClick += new System.EventHan dler
(this.Sbmt_Cli ck);
this.Purchase.S erverClick += new
System.Web.UI. ImageClickEvent Handler(this.Pu rchase_Click);
this.Load += new System.EventHan dler
(this.Page_Loa d);
}
--> Try

this.Purchase.C lick += newSystem.Web.UI. ImageClickEvent Handler(this.Pu rchase_Click);

public void Purchase_Click( object sender,
System.Web.UI. ImageClickEvent Args e)
{
Response.Write( "Purchase_C lick Fired!!!");
Response.End();
}
private void Sbmt_Click(obje ct sender, System.EventArg s e)
{
Response.Write( "Purchase_C lick Fired!!!");
Response.End();
}
.

Nov 17 '05 #2
JP
Click is not a defined methed of HTMLInputImage
And the compilier throws and error stating that if i try.
-----Original Message-----
Please find my suggestion inlined with your code....

HTH
-----Original Message-----
ow do I get a HtmlInputImage to raise the ServerClickevent

I have two inputs one is a submit button the other is a
image. The submit button works the input image does not.
Does anyone know why this would happen?

I would like to mention that I have overridden viewstate
and do not use server side forms.

Below is my code maybe I am missing something

<input type="image" src="~/img/btnPurchase.gif "

width="90"
height="26" id="Purchase" runat="server">
<input type="submit" id="sbmt" runat="server"
value="submit ">

and the code behind is as follows.

protected System.Web.UI.H tmlControls.Htm lInputImage
Purchase;
protected System.Web.UI.H tmlControls.Htm lInputButton sbmt;
private void InitializeCompo nent()
{
this.sbmt.Serve rClick += new System.EventHan dler
(this.Sbmt_Cl ick);
this.Purchase.S erverClick += new
System.Web.UI .ImageClickEven tHandler (this.Purchase_ Click); this.Load += new System.EventHan dler
(this.Page_Lo ad);
}


--> Try

this.Purchase. Click += new
System.Web.UI .ImageClickEven tHandler (this.Purchase_ Click);

public void Purchase_Click( object sender,
System.Web.UI .ImageClickEven tArgs e)
{
Response.Write( "Purchase_C lick Fired!!!");
Response.End();
}
private void Sbmt_Click(obje ct sender, System.EventArg s

e){
Response.Write( "Purchase_C lick Fired!!!");
Response.End();
}
.

.

Nov 17 '05 #3
Hi JP,

I am not sure about what you have done in "I would like to mention that I
have overridden viewstate and do not use server side forms." but I believe
that this issue is caused by it.

I have tried a simple test on my side and the HtmlInputImage. ServerClick
works fine. Please try the following testing steps on your side.

1. Create a default Web application.

2. Add the following HTML code directly between the "form" tag in the HTML
View.

<input type="image" src="~/img/btnPurchase.gif " width="90" height="26"
id="Purchase" runat="server" NAME="Purchase" >
<input type="submit" id="sbmt" runat="server" value="submit" NAME="sbmt">

3. Switch to the Design View. Double click the buttons to add the event
handler.
...
private void Purchase_Server Click(object sender,
System.Web.UI.I mageClickEventA rgs e)
{
Response.Write( "Image Purchase_Click Fired!!!");
}

private void sbmt_ServerClic k(object sender, System.EventArg s e)
{
Response.Write( "Purchase_C lick Fired!!!");
}
...

4. Build and test the application. Everything works fine.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #4
JP
Yes this works.
I was hoping to find a reason why buttons work with out a
valid viewstate but a htmlinputimage doesn't
-----Original Message-----
Hi JP,

I am not sure about what you have done in "I would like to mention that I have overridden viewstate and do not use server side forms." but I believe that this issue is caused by it.

I have tried a simple test on my side and the HtmlInputImage. ServerClick works fine. Please try the following testing steps on your side.
1. Create a default Web application.

2. Add the following HTML code directly between the "form" tag in the HTML View.

<input type="image" src="~/img/btnPurchase.gif " width="90" height="26" id="Purchase " runat="server" NAME="Purchase" >
<input type="submit" id="sbmt" runat="server" value="submit" NAME="sbmt">
3. Switch to the Design View. Double click the buttons to add the event handler.
...
private void Purchase_Server Click(object sender,
System.Web.UI. ImageClickEvent Args e)
{
Response.Write( "Image Purchase_Click Fired!!!"); }

private void sbmt_ServerClic k(object sender, System.EventArg s e) {
Response.Write( "Purchase_C lick Fired!!!");
}
...

4. Build and test the application. Everything works fine.

If I have misunderstood your concern, please feel free to let me know.
Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
.

Nov 17 '05 #5
Hi JP,

Thank you for your update.

As I have mentioned before, I am not sure about what you have done in "I
would like to mention that I have overridden viewstate and do not use
server side forms."

I am trying to reproduce your problem on my side now. Would you please tell
me how to reproduce the problem on my side with my simple testing sample in
my previous post? It will be helpful to find the root cause for this issue.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #6

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

Similar topics

1
1434
by: Qin Zhou | last post by:
I felt silly to ask this question, but since I don't know the answer.... So here it goes. Is there a server control for the html <map> tag? Thanks Qin Zhou
2
2107
by: mathieu cupryk | last post by:
I have problems with listboxes in the webform2.cs, the textboxes are working well when I do a click on next. I am missing something. It works with the textboxes. Here is the file: using System; using System.Collections; using System.Collections.Specialized; using System.ComponentModel; using System.Data; using System.Drawing;
2
1591
by: CodeRazor | last post by:
I am building my html page in .net. After i click a button, i want an outline/border to appear around my button. I have found the HtmlInputImage.Border property and although it prints out (border="5") in the html when i view source, it fails to show anything in the browser. What am I failing to do here? My code behind: private void...
0
2909
by: Jon Cosby | last post by:
I'm trying to find a simple script for hiding my email until the user chooses to send a message. I thought I might be able to do this with the ServerClick event on the HTML anchor, setting the valid url there. What happens is that some JavaScript code is added, and the url is replaced by call to a "__doPostBack" function:...
0
5729
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is selected, it causes the ServerClick event to be called twice. Here's the code: You'll see that there are two grids on the page, and that the...
2
2637
by: Alex | last post by:
In my Asp.net application, I have come across a situation where I cannot prevent a postback using the HtmlInputImage control. If I use the HtmlInputButton, the post back is not automatic, however with the HtmlInputImage, it appears to be. Add this to your aspx test app and set a breakpoint in your Page_Load. <input type="button" id="TheButton"...
9
2213
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see) in page_load, or elsewhere, that says page.validate, no control says "causesvalidation=true", and the AutoEventWireup is set to false. So I would...
6
1434
by: schleichv | last post by:
Hello, I am attempting to get the ServerClick event to fire on a dynamically generated HtmlInputImage and having no luck at all. I've looked over many items on the forums but none seem to cover what seems to be happening to me. Below is a small test I have put together to demonstrate the issue. The form has an HtmlInputImage on it that...
4
1512
by: David Jia | last post by:
Hi, I have a problem in VS2003 and .Net 1.1 as below: I put a HTML submit button control and label it as "run @ server" My purpose is that when click this button, system will check the input fields' value so I write on form's onsubmit method is "return checkfield()" BUT, after I compose some code in button's server click method in C#...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6277
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2105
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.