My Profile

Sunday, February 6, 2011

More Image Controls

ASP.Net provides ImageButton and ImageMap, which are also image related controls.


ImageButton: is a PostBack control which submits the form to server unlike normal image is non-post back controls.


ImageMap: is a rich control, which provides area wise selection within the image. We can define HotSpots (area within image) and provide action when user selects that particular area.


To use ImageButton, just place it and write code in it like a button.


Example:



  • Place an image control in form and assign ImageUrl 

  • Coding
         Under ImageButton Click event

        ImageButton1.ImageUrl = "~/Images/online-banking-1.jpg"; //assign some diff image url.




To use ImageMap, place it in the form and set ImageUrl property with related image.
once image is provided use "HotSpots" collection for defining multiple hotspots and their action.

            Action:

                  HotSpotMode  :   Navigate
                  NavigateUrl      :   <pagename>
                  AlternateText    :   <some text >

            Action:

                  HotSpotMode  :   PostBack
                  PostBackvalue  :  <value>
                  AlternateText    :   <some text >

Then double click on ImageMap control and write code to check which hotspot is selected followed by result.


----------------------------------------------------------

** If you like this post please like our page in facebook


0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More