Drag a Sql Data Source control from the data tab of Visual Studio 2008.Configure it with the Database Server; I have used a database in App_Data folder.You can notice that I am passing a parameter in this method called sort Expression.After getting records into Data Table, I am sorting it based on the sortexpression passed to this method.If you are learning asp: List View control while reading this article, you may copy-paste code described here.I have also provided downloadable code, please feel free to download and use it.In this template I have created a link button called Insert and specified Command Name as Insert.
To add records using List View control, you need to add inside Grid View (Code - 1).To Edit records in List View control, we need to add Edit Item Template (Code - 1).Clicking Edit link in the default mode for respective record bring that record into Edit mode so that user can modify the record.Download the code attached with this article to see it in action. If you are usingprotected void Page_Load(object sender, Event Args e)then your Item Editing handler should look like thisprotected void lv Employee_Item Editing(object sender, List View Edit Event Args e)or you are never get Edit Template activated I was having some trouble getting my edit template to work. Except the edittemplate, when I click the edit button, he never shows the edit Template. Hi, In the Configure List View Options I'm unable to select "Enable Editing, Inserting, Deleting". Also when I try to force it, the browser displays error: "Inserting is not supported by data source 'Sql Data Source1' unless Insert Command is specified."When I configure the data source of my listview and I clicked the advance the Generate Insert, Update, Delete Statments checkbox is disabled. How do I enable the checkbox in order to use the add edit delete for my listview? I had to go through about 20 other posts before I found yours.