⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bianji.aspx

📁 用asp.net开发的考试系统
💻 ASPX
字号:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="bianji.aspx.cs" Inherits="Default2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    课程选择:
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
        DataTextField="coursename" DataValueField="courseid" Width="158px">
    </asp:DropDownList><br />
    <br />
    <asp:GridView ID="GridView1"  Width="98%" runat="server" AutoGenerateColumns="False" CellPadding="4"
        DataKeyNames="id" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"
        OnRowCommand="GridView1_RowCommand1" OnRowDataBound="GridView1_RowDataBound"  OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnSelectedIndexChanging="GridView1_SelectedIndexChanging1"
      >
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
                SortExpression="id" />
            <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
            <asp:BoundField DataField="jointime" HeaderText="jointime" SortExpression="jointime" />
            <asp:BoundField DataField="courseid" HeaderText="courseid" SortExpression="courseid" Visible="False" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:CommandField SelectText="添加题目" ShowSelectButton="True" />
            <asp:TemplateField Visible="False">
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <RowStyle BackColor="#E3EAEB" />
        <EditRowStyle BackColor="#7C6F57" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:kaoshixitongConnectionString %>"
        DeleteCommand="DELETE FROM [kaoshi] WHERE [id] = @id" InsertCommand="INSERT INTO [kaoshi] ([title], [jointime], [testtime], [courseid]) VALUES (@title, @jointime, @testtime, @courseid)"
        SelectCommand="SELECT * FROM [kaoshi] WHERE ([courseid] = @courseid)" UpdateCommand="UPDATE [kaoshi] SET [title] = @title, [jointime] = @jointime, [testtime] = @testtime, [courseid] = @courseid WHERE [id] = @id">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="jointime" Type="DateTime" />
            <asp:Parameter Name="testtime" Type="DateTime" />
            <asp:Parameter Name="courseid" Type="String" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="courseid" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="jointime" Type="DateTime" />
            <asp:Parameter Name="testtime" Type="DateTime" />
            <asp:Parameter Name="courseid" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    &nbsp;
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:kaoshixitongConnectionString %>"
        SelectCommand="SELECT * FROM [kecheng]"></asp:SqlDataSource>
</asp:Content>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -