Chapter 5. Adding Command Buttons to the Data Web Controls

IN THIS CHAPTER

  • Adding a Command Button to a Template

  • Command Buttons That Trigger Events Other Than ItemCommand

  • Creating Select Command Buttons

  • On the Web

In the last chapter we examined how to extend the functionality of the DataGrid Web control by adding ButtonColumn and HyperLinkColumn columns. The ButtonColumn, as you'll recall, adds either a standard HTML button or hyperlink to each row in the DataGrid; when this button or hyperlink is clicked, the ASP.NET Web page is posted back, and the DataGrid's ItemCommand event is fired. With the HyperLinkColumn, a standard hyperlink is added to each row in the DataGrid; when clicked, the user is automatically taken to the specified URL.

Unfortunately, the ButtonColumn and HyperLinkColumn can only be used with the DataGrid Web control, and not with the DataList or Repeater. The reason these column controls are absent is because the DataList and Repeater do not support the notion of columns like the DataGrid does. Rather, the DataList and Repeater are built from templates.

The good news is that the data Web controls can have standard ASP.NET Button and LinkButton controls added to their templates. When these Button and LinkButton controls are clicked, the data Web control's ItemCommand event is fired, just like it is for the DataGrid's ButtonColumn control.

In this chapter, we'll examine how to add command buttons ASP.NET's Button, LinkButton, and ImageButton controls to data Web control templates. Specifically, we'll be looking at using these controls in the templates for the DataList and Repeater, as well as in the TemplateColumns of the DataGrid.



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