• PlaceHolder


    PlaceHolder 控件用于为代码添加的控件预留空间。在页控件层次结构中为以编程方式添加的控件保留位置。

    注释:PlaceHolder 不会产生任何可见的输出(仅仅是网页上其它控件的容器)。

    设计如图:

    打开源:

    <body>
        <form id="form1" runat="server">
        <div>
            <table style=" 100%;">
                <tr>
                    <td>
                        &nbsp;
                        昵称:</td>
                    <td>
                        &nbsp;
                        &nbsp;
                        相片:</td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                        法拉利f430</td>
                    <td>
                        &nbsp;
                        <asp:PlaceHolder ID="placeCar" runat="server"></asp:PlaceHolder>
                    </td>
                </tr>
                </table>
        </div>
        </form>
    </body>

    在该网站新建文件夹Images 粘贴一张图片到该文件夹下面

    打开后置cs

        protected void Page_Load(object sender, EventArgs e)
        {
            TextBox txtUserName = new TextBox();
            txtUserName.Text = "请写上你的大名:";
            this.form1.Controls.Add(txtUserName);

            Image image = new Image();
            image.ImageUrl = "~/Images/falali.jpg";
            this.placeCar.Controls.Add(image);
        }

    效果如图:

  • 相关阅读:
    mysql 数据库 分表后 怎么进行分页查询?Mysql分库分表方案?
    mysql分库分区分表
    Mysql分表和分区的区别、分库和分表区别
    shell 浮点数和整数比较大小
    Domino's Pizza 点餐
    Long John Silver's 点餐
    韩国bibigo饺子做煎饺到方法
    其他的知名餐饮
    KFC 点餐
    Macdonald 点餐
  • 原文地址:https://www.cnblogs.com/scsuns520/p/1633585.html
Copyright © 2020-2023  润新知