<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:universityConnectionString %>" 
            SelectCommand="SELECT * FROM [student]" 
            InsertCommand="INSERT INTO student(fname, lname, average, stno, sex, course) VALUES (@fname, @lname, @average, @stno, @sex, @course)"></asp:SqlDataSource>
    
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataSourceID="SqlDataSource1" DefaultMode="Insert" Height="50px" 
            Width="239px" Font-Bold="True" 
            onpageindexchanging="DetailsView1_PageIndexChanging">
            <Fields>
                <asp:BoundField DataField="fname" HeaderText="نام" SortExpression="fname" />
                <asp:BoundField DataField="lname" HeaderText="نام خانوادگی" 
                    SortExpression="lname" />
                <asp:BoundField DataField="average" HeaderText="معدل" 
                    SortExpression="average" />
                <asp:BoundField DataField="stno" HeaderText="شماره دانشجویی" 
                    SortExpression="stno" />
                <asp:CheckBoxField DataField="sex" HeaderText="جنسیت" SortExpression="sex" />
                <asp:BoundField DataField="course" HeaderText="رشته تحصیلی" 
                    SortExpression="course" />
                <asp:CommandField ShowInsertButton="True" ButtonType="Button" 
                    CancelText="انصراف" InsertText="درج رکورد" />
            </Fields>
        </asp:DetailsView>
    
    </div>
    </form>
</body>
</html>
