• 每日日报2021.3.23


    今天完成内容:

    学习Android

    4.GridView和下拉菜单DropDownList结合:

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.SqlClient;
    public partial class Default4 : System.Web.UI.Page
    {
        SqlConnection sqlcon;
        string strCon = "Data Source=(local);Database=北风贸易;Uid=sa;Pwd=sa";
        protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList ddl;
            if (!IsPostBack)
            {
                string sqlstr = "select top 5 * from 飞狐工作室";
                sqlcon = new SqlConnection(strCon);
                SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlcon);
                DataSet myds = new DataSet();
                sqlcon.Open();
                myda.Fill(myds, "飞狐工作室");
                GridView1.DataSource = myds;
                GridView1.DataBind();
                for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
                {
                    DataRowView mydrv = myds.Tables["飞狐工作室"].DefaultView[i];
                    if (Convert.ToString(mydrv["员工性别"]).Trim() == "True")
                    {
                        ddl = (DropDownList)GridView1.Rows[i].FindControl("DropDownList1");
                        ddl.SelectedIndex = 0;
                    }
                    if (Convert.ToString(mydrv["员工性别"]).Trim() == "False")
                    {
                        ddl = (DropDownList)GridView1.Rows[i].FindControl("DropDownList1");
                        ddl.SelectedIndex = 1;
                    }
                }
                sqlcon.Close();
            }
        }
        public SqlDataReader ddlbind()
        {
            string sqlstr = "select distinct 员工性别 from 飞狐工作室";
            sqlcon = new SqlConnection(strCon);
            SqlCommand sqlcom = new SqlCommand(sqlstr, sqlcon);
            sqlcon.Open();
            return sqlcom.ExecuteReader();
        }

    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                            CellPadding="3" Font-Size="9pt"  BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px">
                            <FooterStyle BackColor="White" ForeColor="#000066" />
                            <Columns>
                                 <asp:BoundField DataField="身份证号码" HeaderText="用户ID" SortExpression="身份证号码" />
                                <asp:BoundField DataField="姓名" HeaderText="用户姓名" SortExpression="姓名"/>
                                <asp:TemplateField HeaderText="员工性别">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server" DataSource='<%# ddlbind()%>' DataValueField="员工性别" DataTextField="员工性别">
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="家庭住址" HeaderText="家庭住址" SortExpression="家庭住址"/>
                                    
                            </Columns>
                            <RowStyle ForeColor="#000066" />
                            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                        </asp:GridView>

    2.看视频

    遇到问题:

    明日目标:

    学习Android studio的开发

  • 相关阅读:
    [Blockchain] 去中心化与互联网分布式的联系与区别
    [FAQ] Solidity 并发执行 ? 重入攻击 ?
    [Contract] Solidity 多种访问控制 (Access Control) 实现方式
    [Contract] 一次搞懂 Solidity 的 using xx for xx
    [FAQ] VisualStudio, Source file requires different compiler version (current compiler is 0.6.1+cxxxxxx)
    [Ethereum] 浅谈 ERC20 在 openzeppelin-contracts 中的结构与实现
    [Ethereum] 浅谈加密商品市场 OpenSea 与 opensea-js
    [Cloud] Google colab GPU 免费使用, 可挂载 Google drive
    [Ethereum] Gas Station Network (GSN) eip-1613 与 Gas Relay Network (GRN) eip-1077
    [Contract] truffle-flattener 合并 Solidity 文件的依赖到一个文件
  • 原文地址:https://www.cnblogs.com/leiyu1905/p/14909748.html
Copyright © 2020-2023  润新知