<asp:ScriptManager ID="smForm" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="upForm" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966"
BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="ID"
DataSourceID="sqlUser">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<RowStyle BackColor="White" ForeColor="#330099" />
<Columns>
<asp:CommandField HeaderText="操作" ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="UserName" HeaderText="UserName" />
<asp:BoundField DataField="Email" HeaderText="Email" />
<asp:BoundField DataField="RoleID" HeaderText="RoleID" />
<asp:BoundField DataField="CreateDate" HeaderText="CreateDate" />
</Columns>
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
</asp:GridView>
<asp:SqlDataSource ID="sqlUser" runat="server"
ConnectionString="<%$ ConnectionStrings:CMSDBConnectionString %>"
DeleteCommand="DELETE FROM [User] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [User] ([UserName], [Password], [Email], [RoleID], [CreateDate]) VALUES (@UserName, @Password, @Email, @RoleID, @CreateDate)"
SelectCommand="SELECT * FROM [User]"
UpdateCommand="UPDATE [User] SET [UserName] = @UserName, [Password] = @Password, [Email] = @Email, [RoleID] = @RoleID, [CreateDate] = @CreateDate WHERE [ID] = @ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="RoleID" Type="Int32" />
<asp:Parameter Name="CreateDate" Type="DateTime" />
<asp:Parameter Name="ID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="RoleID" Type="Int32" />
<asp:Parameter Name="CreateDate" Type="DateTime" />
</InsertParameters>
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
GridView控件实现无刷新数据操作
最新推荐文章于 2017-08-30 17:03:47 发布