Summary

In this chapter, we examined how to use command buttons in the templates of the data Web controls. Recall that the command buttons include the ASP.NET Button, LinkButton, and ImageButton controls. When placed in a template, the command button causes a postback to the ASP.NET page, raising the ItemCommand event for the data Web control. By providing an event handler for this event, you can associate server-side code with the user's action of clicking a command button.

We also briefly looked at the additional command button events provided by the DataGrid and DataList, which include: SortCommand, EditCommand, UpdateCommand, CancelCommand, and DeleteCommand. These events have been added to make programming for sorting, editing, and deleting functionality easier and the end code more readable.

Finally, we examined how to use command buttons to mark a row as "selected." To specify that a row is the selected one, you can either explicitly set the SelectedIndex property programmatically, or simply set the CommandName property to "Select" for the command button that is responsible for designating a row as being selected. With both the DataGrid and DataList controls, a selected row can have its display properties specified by the SelectedItemStyle property. The DataList, however, can also customize the actual content of the selected row via the SelectedItemTemplate.

In this and the previous chapter we studied how to add command buttons to the various data Web controls and how to have the data Web controls respond to the user clicking the command buttons. In the next chapter, we'll look at how to have the events raised by controls external to the data Web controls affect the data Web controls.



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