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

📄 default.aspx

📁 This is java book for student!!!
💻 ASPX
字号:
<%@ 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>test data</title>
</head>
<body>
    <form id="form1" runat="server">
        <div style="text-align: center">
            <table style="width: 700px">
                <tr>
                    <td align="center">
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                            AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="AccessDataSource1"
                            Width="100%" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Caption="Danh sach hoc vien" HorizontalAlign="Center" ToolTip="Danh sach hoc vien" OnRowUpdating="GridView1_RowUpdating" PageSize="5">
                            <Columns>
                                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                                    SortExpression="ID" />
                                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                                <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
                                <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />                             
                              
                              <asp:TemplateField HeaderText="Notes" SortExpression="Notes">
                                  <EditItemTemplate>
                                        <asp:TextBox ID="Notes" runat = "server" TextMode="MultiLine" Text='<%# Bind("Notes") %>' ></asp:TextBox>
                                  </EditItemTemplate>
                                  <ItemTemplate>
                                      <asp:label ID="Notes" runat="server"  Text='<%# Bind("Notes") %>' ></asp:label>
                                  </ItemTemplate>
                              </asp:TemplateField>                                 
                               
                              <asp:TemplateField HeaderText="NameClass" SortExpression="NameClass">
                                  <EditItemTemplate>
                                       <asp:DropDownList ID="ClassIDDropDownList2" runat="server" DataSourceID="AccessDataSource2"
                                          DataTextField="NameClass" DataValueField="ClassID" SelectedValue='<%# Bind("ClassID") %>'>
                                      </asp:DropDownList>
                                  </EditItemTemplate>
                                  <ItemTemplate>
                                      <asp:label ID="ClassID" runat="server"  Text='<%# Bind("NameClass") %>' ></asp:label>
                                  </ItemTemplate>
                              </asp:TemplateField>                                
                                
                                <asp:CommandField ShowEditButton="True" />
                                <asp:CommandField ShowDeleteButton="True" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" />
                            <RowStyle ForeColor="#000066" HorizontalAlign="Center" Wrap="True" />
                            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle HorizontalAlign="Center" />
                            
                        </asp:GridView>

                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="ID" DataSourceID="AccessDataSource1"
                            DefaultMode="Insert" ForeColor="#333333">
                            <InsertItemTemplate>
                                <br />
                                <div style="text-align: center">
                                    <table>
                                        <tr>
                                            <td colspan="3">
                                                Enter informatin personal</td>
                                        </tr>
                                        <tr>
                                            <td >
                                            </td>
                                            <td >
                                            </td>
                                            <td >
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                Name:
                                            </td>
                                            <td >
                                            </td>
                                            <td >
                                <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <td >
                                Email:
                                            </td>
                                            <td >
                                            </td>
                                            <td >
                                <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <td >
                                Phone:</td>
                                            <td >
                                            </td>
                                            <td >
                                <asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>'></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <td >
                                Address:</td>
                                            <td >
                                            </td>
                                            <td >
                                <asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <td >
                                Notes:</td>
                                            <td >
                                            </td>
                                            <td >
                                <asp:TextBox ID="NotesTextBox" runat="server" Text='<%# Bind("Notes") %>' Columns="17" TextMode="MultiLine"></asp:TextBox></td>
                                        </tr>
                                        <tr>
                                            <td >
                                ClassID:&nbsp;</td>
                                            <td >
                                            </td>
                                            <td >
                                                <asp:DropDownList ID="ClassIDDropDownList1" runat="server" DataSourceID="AccessDataSource2"
                                                    DataTextField="NameClass" DataValueField="ClassID" SelectedValue='<%# Bind("ClassID") %>'>
                                                </asp:DropDownList></td>
                                        </tr>
                                        <tr>
                                            <td >
                                            </td>
                                            <td >
                                            </td>
                                            <td >
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3">
                                                <div style="text-align: center">
                                                    <table>
                                                        <tr>
                                                            <td align="center" style="width: 36px">
                                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                                    Text="Insert"></asp:LinkButton></td>
                                                            <td align="center">
                                                            </td>
                                                            <td align="center" style="width: 35px">
                                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                    Text="Cancel"></asp:LinkButton></td>
                                                        </tr>
                                                    </table>
                                                </div>
                                <asp:RegularExpressionValidator ID="RegExpreEmail" runat="server" ControlToValidate="EmailTextBox"
                                    ErrorMessage="Email is invalid!" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                    Width="145px"></asp:RegularExpressionValidator></td>
                                        </tr>
                                    </table>
                                </div>
                            </InsertItemTemplate>

                        </asp:FormView>
                        
                    </td>
                </tr>
            </table>
        </div>
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/Northwind.mdb"
    SelectCommand="SELECT [ClassID], [NameClass] FROM [Class]">
</asp:AccessDataSource>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Northwind.mdb"
    SelectCommand="SELECT Personal.ID, Personal.Name, Personal.Email, Personal.Phone, Personal.Address, Personal.Notes, Personal.ClassID, Class.NameClass FROM (Personal INNER JOIN Class ON Personal.ClassID = Class.ClassID)" 
    UpdateCommand="UPDATE Personal SET  Email =@Email, Name =@Name, Phone =@Phone,  Address =@Addresss, Notes =@Notes,ClassID=@ClassID where ID=@ID" 
    DeleteCommand="DELETE FROM Personal where ID=@ID" 
    InsertCommand="INSERT INTO Personal(Name, Email, Phone, Address, Notes,ClassID) VALUES(@Name, @Email, @Phone, @Address, @Notes, @ClassID)">
</asp:AccessDataSource>                        
        
    </form>
</body>
</html>

⌨️ 快捷键说明

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