Using InsertItemTemplate with ItemCommand
I will demonstrate how to utilize InsertItemTemplate and InsertCommand in order to add a new record to the Country table. First, add the buttons which will show and hide the InsertItemTemplate by using the InsertItemPosition property of ListView:
Their associated OnClick events are:
For the initial loading of the page, set InsertItemPosition property of the ListView to None:
Now, place the InsertItemTemplate somewhere between the ListView tags like the other templates:
Like I did in this post before for the Edit and Delete commands, I will add a similar custom routine for the Insert command inside the ItemCommand event:
View on the HTML presentation is now supposed to be like:
If “Show Insert” button is clicked:
Put some meaningful entries to the textboxes:
It’s there, inserted:
Also, pay attention that “Hide Insert” button becomes “Show Insert” button.
For more hands-on understanding of this post, you can download the sample (by VWD 2008) via here.
Recently I encountered a case when I knew much more about the data than the optimizer. Originally the performance was horrible, this is why...
ASP.NET 4 adds built-in support for using routing with Web Forms. Routing lets you configure an application to accept request URLs that do...
Introduction Web Service is known as the software program. These services use the XML to exchange the information with the other software wi...
Most experienced developers will tell you that end users tend to "judge an application by its cover". In other words, they don'...
Introduction Advanced Integration is for sellers who want more flexibility when creating payment buttons. Advanced Integration facilitates t...