How do I to assign a submit event to a clicked image

Posted on 2006-05-21
Last Modified: 2010-04-16
I want to have an image as a submit rather than the grey submit button.  The code that I have for the submit button now is:

private void cmdLogin_ServerClick(object sender, System.EventArgs e)
      if (ValidateUser(txtUserName.Value,txtUserPass.Value) )
            Response.Redirect("logon.aspx", true);

Do I need to right-click on the image and run it as a server control?  How do I assign the piece of code above to that image being clicked?
Question by:michael1174
    LVL 10

    Accepted Solution

    u can use the ImageButton Web Server Control.

    set the ImageUrl property of the image button.

    add the above code to the image button's click event.

    LVL 2

    Author Comment

    Thank you!

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Article by: Najam
    Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now