亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

FormView的插入模板中的DropDownList控件參數

發布時間:2020-06-30 02:19:26 來源:網絡 閱讀:666 作者:chul72 欄目:編程語言

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" 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>
    <p>控件SqlDataSource與FormViw應用之在插入模板添加控件DropDwonList并保存記錄實例</p>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HRM_DATAConnectionString %>"
            SelectCommand="SELECT [CompanyID], [Company] FROM [tblCompany]">
        </asp:SqlDataSource>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            DataKeyNames="CompanyID" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="CompanyID" HeaderText="CompanyID"
                    InsertVisible="False" ReadOnly="True" SortExpression="CompanyID" />
                <asp:BoundField DataField="Company" HeaderText="Company"
                    SortExpression="Company" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"
            ConnectionString="<%$ ConnectionStrings:HRM_DATAConnectionString %>"
            InsertCommand="INSERT INTO tblDepart(Depart, CompanyID) VALUES (@Depart,@CompanyID)"
            SelectCommand="SELECT tblDepart.DepartID, tblDepart.Depart, tblCompany.Company, tblDepart.CompanyID FROM tblDepart INNER JOIN tblCompany ON tblDepart.CompanyID = tblCompany.CompanyID WHERE (tblCompany.CompanyID = @Companyid)">
            <InsertParameters>
                <asp:Parameter Name="Depart" />
                <asp:Parameter Name="CompanyID" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="Companyid"
                    PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:FormView ID="FormView1" runat="server" AllowPaging="True"
            BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px"
            CellPadding="4" DataKeyNames="DepartID" DataSourceID="SqlDataSource2"
            GridLines="Both" Height="125px" Width="566px">
            <EditItemTemplate>
                DepartID:
                <asp:Label ID="DepartIDLabel1" runat="server" Text='<%# Eval("DepartID") %>' />
                <br />
                Depart:
                <asp:TextBox ID="DepartTextBox" runat="server" Text='<%# Bind("Depart") %>' />
                <br />
                Company:
                <asp:TextBox ID="CompanyTextBox" runat="server" Text='<%# Bind("Company") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
                    CommandName="Update" Text="更新" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server"
                    CausesValidation="False" CommandName="Cancel" Text="取消" />
            </EditItemTemplate>
            <EditRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <InsertItemTemplate>
                Depart:
                <asp:TextBox ID="DepartTextBox" runat="server" Text='<%# Bind("Depart") %>' />
                <br />
                Company:
                <asp:DropDownList ID="DropDownList1" runat="server"
                    DataSourceID="SqlDataSource1" DataTextField="Company"
                    DataValueField="CompanyID" SelectedValue='<%# Bind("CompanyID") %>'>
                </asp:DropDownList>
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
                    CommandName="Insert" Text="插入" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server"
                    CausesValidation="False" CommandName="Cancel" Text="取消" />
            </InsertItemTemplate>
            <ItemTemplate>
                DepartID:
                <asp:Label ID="DepartIDLabel" runat="server" Text='<%# Eval("DepartID") %>' />
                <br />
                Depart:
                <asp:Label ID="DepartLabel" runat="server" Text='<%# Bind("Depart") %>' />
                <br />

                Company:
                <asp:Label ID="CompanyLabel" runat="server" Text='<%# Bind("Company") %>' />
                <br />
                <br />
                <br />
                <asp:LinkButton ID="LinkButton1" runat="server" CommandName="New">New</asp:LinkButton>
            </ItemTemplate>
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#330099" />
        </asp:FormView>
        <br />
        <br />


    </div>
    </form>
</body>
</html>


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

蒙阴县| 莱芜市| 深泽县| 多伦县| 武胜县| 抚宁县| 榕江县| 平湖市| 荣成市| 津市市| 融水| 鸡西市| 木里| 台湾省| 开远市| 天峨县| 长垣县| 盐城市| 武乡县| 肃南| 杭州市| 原平市| 威海市| 湟中县| 桦南县| 湖州市| 太谷县| 汝州市| 全州县| 河池市| 韩城市| 临洮县| 呼和浩特市| 平谷区| 油尖旺区| 赞皇县| 库车县| 梓潼县| 同江市| 莲花县| 民勤县|