Summary

In this chapter, we examined the DataGrid's built-in editing functionality. When using the DataGrid's editing functionality, an EditCommandColumn column needs to be added to the DataGrid; this special column type adds an Edit button next to each row. When the Edit button is clicked, the ASP.NET Web page is posted back and the DataGrid's EditCommand event is fired. We then need to provide an event handler for the event that sets the DataGrid's EditItemIndex property to the index of the row we want to edit. Doing this transforms the particular row into an editable row, converting the Edit button to Update and Cancel buttons, and converting each column in the row into the column's editing interface.

By default, a column's editing interface is a simple TextBox. However, we can specify a customized editing interface in the EditItemTemplate of a TemplateColumn. For example, in this chapter, we saw how to add a multiline TextBox, a Calendar control, and a data-bound DropDownList to the editing interface of various columns in a DataGrid. Additionally, we examined how to add validation controls to the interface.

In the next chapter, we will meld the lessons learned in this chapter and the last two. We will see how, using just a DataGrid, we can create a user interface that supports sorting and paging through data, as well as adding, editing, and deleting information!



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