Solved

Webform: Click picture instead of a button to submit?

Posted on 2004-09-27
9
265 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

695 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