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 155tools for data—the table. Data display in a table is most useful where your application displaysdata stored in a database table. To discuss tables at this point would be premature, but in thechapters after the introduction of ADO.<strong>NET</strong>, you will see several different table-related tools.TextBox (as a Data Display)For the most part the TextBox web control examples have been used for the purpose ofdata entry. The default TextBox is very similar to an HTML Input (Text) form. However,you may also use the TextBox for data display. You have a lot of text and only enoughspace on your page for a limited view of the text; your display needs a scroll bar. Usingthe HTML TextArea form, you saw how a large amount of text fit into the form because ofthe form’s ability to be scrolled. The TextBox can do the same thing, and all you have todo is change the size and a few properties. The following list shows the key properties tochange to create a TextBox that can be used to display and scroll large amounts of text:PropertyHeightWidthTextModeReadOnlyValueN pxN pxMultiLineTrueThe Height and Width properties are set to fit the design. More importantly, theTextMode property needs to be changed to MultiLine. Finally, because the TextBoxis to be used for data display instead of data entry, change the status of the ReadOnlyproperty from false to true.In addition you can apply any of the other TextBox properties, such as color, font,and other features of the object. The up<strong>com</strong>ing Figure 6-18 shows that the text insidethe TextBox is different from the other text in the application and includes a shadedbackground. So in addition to data entry, it’s easy to reconfigure the TextBox object to actas a data display tool.Label and Literal Web ControlsThe Label and Literal web controls are very similar, and the differences that have beenattributed to them are almost the stuff of urban legends. Both are used for placing texton the page, both can be used with CSS, and both use the Text property for output.To best see the differences between the two web controls, look at Figure 6-17. On the left,you will see that the Literal only has a few properties in the Properties window, while theLabel at right has many.

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

Saved successfully!

Ooh no, something went wrong!