Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Webform: Click picture instead of a button to submit?

Posted on 2004-09-27
9
Medium Priority
?
270 Views
Last Modified: 2010-04-15
Hi there,

just created a webform and normally I would have a submit button that would automatically submit it to the server so I can pickup up my click event on asp.net..

Is it possible to click a picture i have instead of a button?

I have used a standard <img src=""> to insert my picture .... I suppose I should have used a Picture VS.NET Web control?? Is this correct?

I wonder if its possible to force a <img src=""> to submit a form and how I would go about this?

Any help or info would be gratefully appreciated

Ian
0
Comment
Question by:ianinspain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 

Author Comment

by:ianinspain
ID: 12161894
Ermm strange... just tried adding a Image control to the webform ... and it displays ok... if I double click the image control I was suspecting I would goto codebehind view and get a Image1_click event.... but it doesn't give me one..

Am I missing something..??

0
 
LVL 15

Expert Comment

by:praneetha
ID: 12162114
no use image button instead

<asp:ImageButton id="ImageButton1" runat="server"></asp:ImageButton>

and u can double click to see teh click event
0
 
LVL 3

Expert Comment

by:stu_pb
ID: 12162214
You can use JavaScript to do this.

<img src="yourImage" onclick="document.all.yourFormName.submit()"></img>

This will submit the form when the image is clicked on.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:ianinspain
ID: 12162226
Hi praneetha...

Yes I tried double clicking it ...which then shows me the codebehind... but I don't see the event being created...

Does it work your end??

0
 
LVL 15

Accepted Solution

by:
praneetha earned 2000 total points
ID: 12162266
yes it does

private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
            {
            

            }


private void InitializeComponent()
            {    
                  this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
                  this.Load += new System.EventHandler(this.Page_Load);

            }
0
 

Author Comment

by:ianinspain
ID: 12162766
ahh it was my fault i used a Image rather than an image button....

whooops!...

I would have thought that the image control would have some events too though..

thanks..
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12162805
i think image control is nothing but html image with runat server...it doesn't have any events..

0
 

Author Comment

by:ianinspain
ID: 12162955
Thanks anyway.. awarding points now..

much appreciated

ian
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12163476
thanks for the points...good luck
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question