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

📄 objectdatasource.aspx

📁 关于ASP.NET制作程序模块
💻 ASPX
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ObjectDataSource.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 style="font-size: 12pt">
    <form id="form1" runat="server">
    <div>
        &nbsp;
        <table style="border:solid 1px green;width:40%">
	        <tr>
		        <td style="background-color:Green">
                    <strong><span style="font-size: 14pt; color: #ffffff">
                    使用ObjectDataSource数据源控件</span></strong></td>
            </tr>
            <tr>
                <td style="height: 24px">
        <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource1"
            DataTextField="state" DataValueField="state" AutoPostBack="True">
        </asp:DropDownList></td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource2" AllowPaging="True" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None">
             <Columns>
                        <asp:BoundField DataField="au_id" HeaderText="编号" SortExpression="au_id" />
                        <asp:BoundField DataField="au_lname" HeaderText="名" SortExpression="au_lname" />
                        <asp:BoundField DataField="au_fname" HeaderText="姓" SortExpression="au_fname" />
                        <asp:BoundField DataField="state" HeaderText="国籍" SortExpression="state" />                        
                        <asp:CommandField ShowEditButton="True" HeaderText="操作" />
                    </Columns>
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#EFF3FB" />
                        <EditRowStyle BackColor="#2461BF" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
                </td>
            </tr>
            <tr>
                <td>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetStates"
            TypeName="Class1"></asp:ObjectDataSource>
        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetAuthorsByState"
            TypeName="Class1" UpdateMethod="UpdateAuthor">
            <UpdateParameters>
                <asp:Parameter Name="au_id" Type="String" />
                <asp:Parameter Name="au_lname" Type="String" />
                <asp:Parameter Name="au_fname" Type="String" />
                <asp:Parameter Name="state" Type="String" />
            </UpdateParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" DefaultValue="state" Name="state"
                    PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
                </td>
            </tr>
        </table>
        &nbsp; &nbsp;
    </div>
    </form>
</body>
</html>

⌨️ 快捷键说明

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