Using ASP.NET 3.5’s ListView and DataPager Controls: Inserting Data
The ListView control is similar to the GridView control in many ways: both display a set of records, both support built-in sorting, paging, editing, and deleting functionality with minimal effort. The ListView differs from the GridView in two key ways: Rather than using fields, the ListView is rendered via templates, which offers the page developer much finer control over the emitted markup, and The ListView supports built-in inserting support The first installment in this series explored the ListView’s template-based rendering. This installment looks at how to use the ListView’s inserting functionality. In a nutshell, inserting data from the ListView requires two steps: defining the inserting interface via the InsertItemTemplate and specifying where the inserting interface should go via the InsertItemPosition property. Much like with editing data from within the ListView , the InsertItemTemplate can contain two-way databinding statements when using a data source control to get the inputs entered by the user from the ListView’s inserting interface into the parameters of the data source control. And like with the editing and deleting workflows, you can programmatically examine and modify the user’s submitted data before inserting the data, cancelling the operation altogether if needed. This article walks through the steps for creating a ListView that allows users to insert records.














