<%@ 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 %>" 
            DeleteCommand="DELETE FROM student WHERE (stno = @stno)" 
            SelectCommand="SELECT * FROM [student]" 
            UpdateCommand="UPDATE student SET fname = @fname, lname = @lname, average = @average, stno = @stno, sex = @sex, course = @course">
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="stno" 
            DataSourceID="SqlDataSource1" PageSize="5">
            <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NextPrevious" 
                NextPageText="Next" PreviousPageText="Prev" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowSelectButton="True" />
                <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" />
            </Columns>
        </asp:GridView>
    
    </div>
    </form>
</body>
</html>
