<div>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataSourceID="SqlDataSource1" DataKeyNames="StuID">
<EditItemTemplate>
StuID:
<asp:TextBox ID="StuIDTextBox" runat="server" Text='<%# Bind("StuID") %>'>
</asp:TextBox><br />
Stuname:
<asp:TextBox ID="StunameTextBox" runat="server" Text='<%# Bind("Stuname") %>'>
</asp:TextBox><br />
Stuage:
<asp:TextBox ID="StuageTextBox" runat="server" Text='<%# Bind("Stuage") %>'>
</asp:TextBox><br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>'>
</asp:TextBox><br />
Zip:
<asp:TextBox ID="ZipTextBox" runat="server" Text='<%# Bind("Zip") %>'>
</asp:TextBox><br />
Grade:
<asp:TextBox ID="GradeTextBox" runat="server" Text='<%# Bind("Grade") %>'>
</asp:TextBox><br />
Class:
<asp:TextBox ID="ClassTextBox" runat="server" Text='<%# Bind("Class") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="更新">
</asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消">
</asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
StuID:
<asp:TextBox ID="StuIDTextBox" runat="server" Text='<%# Bind("StuID") %>'>
</asp:TextBox><br />
Stuname:
<asp:TextBox ID="StunameTextBox" runat="server" Text='<%# Bind("Stuname") %>'>
</asp:TextBox><br />
Stuage:
<asp:TextBox ID="StuageTextBox" runat="server" Text='<%# Bind("Stuage") %>'>
</asp:TextBox><br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>'>
</asp:TextBox><br />
Zip:
<asp:TextBox ID="ZipTextBox" runat="server" Text='<%# Bind("Zip") %>'>
</asp:TextBox><br />
Grade:
<asp:TextBox ID="GradeTextBox" runat="server" Text='<%# Bind("Grade") %>'>
</asp:TextBox><br />
Class:
<asp:TextBox ID="ClassTextBox" runat="server" Text='<%# Bind("Class") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="New"
Text="插入">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消">
</asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
StuID:
<asp:Label ID="StuIDLabel" runat="server" Text='<%# Bind("StuID") %>'></asp:Label><br />
Stuname:
<asp:Label ID="StunameLabel" runat="server" Text='<%# Bind("Stuname") %>'></asp:Label><br />
Stuage:
<asp:Label ID="StuageLabel" runat="server" Text='<%# Bind("Stuage") %>'></asp:Label><br />
Address:
<asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>'></asp:Label><br />
Zip:
<asp:Label ID="ZipLabel" runat="server" Text='<%# Bind("Zip") %>'></asp:Label><br />
Grade:
<asp:Label ID="GradeLabel" runat="server" Text='<%# Bind("Grade") %>'></asp:Label><br />
Class:
<asp:Label ID="ClassLabel" runat="server" Text='<%# Bind("Class") %>'></asp:Label><br />
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit">编辑</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete">删除</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server" CommandName="New">插入</asp:LinkButton>
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DatabindControlsConnectionString %>"
SelectCommand="SELECT * FROM [student]"
InsertCommand="INSERT INTO student(stuID,Stuname,Stuage,Address,Zip,Grade,Class) VALUES (@stuID,@Stuname,@Stuage,@Address,@Zip,@Grade,@Class)"
UpdateCommand="UPDATE student SET stuID=@StuID,Stuname=@Stuname,Stuage=@Stuage,Address=@Address,Zip=@Zip,Grade=@Grade,Class=@Class WHERE StuID=@StuID"
DeleteCommand="DELETE from student WHERE StuID=@StuID">
<DeleteParameters>
<asp:Parameter Name="StuID" DefaultValue="0" />
</DeleteParameters>
</asp:SqlDataSource>
</div>