13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6: Standard Web Controls 161As long as both buttons are outside of the Panel web control container, they will bevisible. Only those web controls inside the Panel web control are not visible. As soon asthe Visible property is changed back to true, all of the objects inside the Panel willappear again.Triggers, Links, and ImagesThis last group of web controls is divided into Triggers, with a focus on buttons; Links,looking at the HyperLink form; and Images, which examine both the Image and ImageMapweb controls. Other triggers, such as those caused by selections in lists, are discussed in theearlier sections about the list web controls. Here the focus will be on triggers whose mainpurpose is to launch an event that changes a behavior.ButtonsButtons have a purpose of bringing about change and are the perfect trigger becausenobody expects them to do anything else but fire off some kind of event. You saw in thisand previous chapters that buttons are simple and effective ways to generate events thatfire methods in C#. In most respects, the different kinds of button web controls behavesimilarly; they just look different from one another. The following three web controlbuttons are available in <strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong>:●●●Button The plain vanilla button has properties to control different aspects of the buttonsuch as the text, color, and dimensions of the button.ImageButton An imported graphic image is used to stand in place of the button image.Any GIF, JPEG, or PNG image can be listed as a value of an ImageUrl property and bedisplayed as the button.LinkButton This web control looks like a default underlined link, but in fact is a buttonin all respects. It does not have a URL property for links (a NavigateURL property),but just looks like a default HTML link.Any of these buttons can be displayed in the Design mode, double-clicked, and then willgenerate C# code for a method that fires when the button is clicked. Their main uniquefeatures involve their appearance and not their functionality.HyperLinkIf you want a simple way to set up a link with another page, use the Hyperlink webcontrol. This control has a NavigateURL property, and the string (containing a URL)assigned to the NavigateURL property launches the targeted URL just as an HTML

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!