Chapter 12. Creating Custom Column Controls for the DataGrid

IN THIS CHAPTER

  • DataGrid Column Basics

  • Steps for Creating a Robust Custom DataGrid Column

  • Using Custom DataGrid Columns to Extend the Functionality of the DataGrid

  • On the Web

As we've seen in numerous examples throughout this book, when using the DataGrid Web control, you can explicitly specify the columns that should appear in the DataGrid by using the Columns tag. There are a number of column types, such as the BoundColumn, which is useful for displaying data from a DataSource field, and the ButtonColumn, which creates a command button for each row. There might be times when you want to display data from a column in a certain way. You might want to display a particular column with a format not supported by the DataFormatString property of the BoundColumn, such as formatting a string as a telephone number. For example, imagine that you have a DataGrid that displays the contents of an online guestbook, as we saw in Chapter 8. One advanced formatting feature you might like to add to the column that displays the message a user adds to the guestbook is the censoring of profanity. That is, you'd like all swear words to be replaced by asterisks, such as replacing "hell" with "****".

Fortunately, you can create your own DataGrid column controls, and use them in your DataGrid, just like you use the built-in DataGrid column controls. In this chapter, we will examine how to create and use custom DataGrid column controls, and discuss the advantages of using them.



ASP. NET Data Web Controls Kick Start
ASP.NET Data Web Controls Kick Start
ISBN: 0672325012
EAN: 2147483647
Year: 2002
Pages: 111

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net