Lecture – Form Objects – ListView

ListView Editing

Prerequisites

If you follow the Case Study – Basic User Template then you should have everything you need on this one.

Summary

Shows how to create a ListView that allows data editing.

Video 

http://online1.daytonastate.edu/player2.php?id=6403675579f6114559c90de0014cd3d6

Reference Materials

Code to add to the ItemTemplate and AlternatingItemTemplate of the ListView

            <asp:Button ID=”EditButton” runat=”server” CommandName=”Edit”                     Text=”Edit” />

Data Source Parameter

    <asp:SqlDataSource ID=”SqlDSUser” runat=”server”         ConnectionString=”<%$ ConnectionStrings:BasicUserTemplate %>”         SelectCommand=”SELECT * FROM [Users] WHERE ([id] = @id)”                 UpdateCommand=”UPDATE Users SET UserPassword = @UserPassword, UserEmail = @UserEmail, UserIsDeletedBit = @UserIsDeletedBit WHERE ([id] = @id)”>        <SelectParameters>            <asp:SessionParameter Name=”id” SessionField=”UserID” Type=”Int32″ />        </SelectParameters>        <UpdateParameters>            <asp:Parameter Name=”UserPassword” />            <asp:Parameter Name=”UserEmail” />            <asp:Parameter Name=”UserIsDeletedBit” />            <asp:SessionParameter Name=”id”  SessionField=”UserID” Type=”Int32″ />        </UpdateParameters>    </asp:SqlDataSource> 

Additional Information