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

溫馨提示×

溫馨提示×

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

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

repeater如何分列顯示以及布局

發布時間:2021-10-14 14:49:33 來源:億速云 閱讀:129 作者:小新 欄目:開發技術

這篇文章主要為大家展示了“repeater如何分列顯示以及布局”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“repeater如何分列顯示以及布局”這篇文章吧。

前臺


<div>
        <table>
            <tr>
                <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
                    <ItemTemplate>
                        <td>
                            <table>
                                <tr>
                                    <td colspan="2">
                                        <img src='<%#"images/"+Eval("FoodPicture") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:Label ID="Label1" runat="server" Text='<%#Eval("FoodName") %>'></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:Label ID="Label2" runat="server" Text=' <%#Eval("FoodPrice") %>'></asp:Label>
                                    </td>
                                    <td>
                                        <input type="image" src="images/product_add.png" onclick="product_add() " />
                                        <%--    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/product_add.png" />--%>
                                        <asp:TextBox ID="TextBox1" Text="1" runat="server" Width="15px" ReadOnly="True"></asp:TextBox>
                                        <input type="image" src="images/product_reduce.png" onclick="product_reduce()" />
                                        <%--<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="images/product_reduce.png" />--%>
                                    </td>
                                </tr>
                                <tr>
                                    <th colspan="2">
                                        <asp:ImageButton ID="ImageButton3" ImageUrl="images/btn_order.gif" runat="server" />
                                    </th>
                                </tr>
                            </table>
                        </td>
                    </ItemTemplate>
                </asp:Repeater>
            </tr>
        </table>
    </div>

后臺

復制代碼 代碼如下:


  public   int i = 1;               

protected void Page_Load(object sender, EventArgs e)

        {

            string sqlstr = @"data source=PC-LENOVE\SQLEXPRESS;initial catalog=KFC;USER ID=SA;PASSWORD=abing520";

            SqlConnection con = new SqlConnection(sqlstr);

            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "SELECT * FROM Foods";

            cmd.Connection = con;

            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            DataTable dt = new DataTable();

            adapter.Fill(dt);

            cmd.Dispose();

            con.Dispose();

            this.Repeater1.DataSource = dt;

            this.Repeater1.DataBind();

        }

        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)

        {

            if (i % 4 == 0)//4是一行顯示列數

            {

                e.Item.Controls.Add(new LiteralControl("</tr><tr>"));

            }

            i++;

        }

以上是“repeater如何分列顯示以及布局”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

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

AI

临桂县| 健康| 历史| 通化县| 天水市| 沧源| 招远市| 海林市| 曲阜市| 米泉市| 扶沟县| 砀山县| 加查县| 石门县| 灵川县| 昭平县| 裕民县| 班玛县| 平谷区| 新丰县| 阿坝县| 巴东县| 麻城市| 莲花县| 永和县| 波密县| 那坡县| 黎平县| 安福县| 宜宾县| 麟游县| 玉门市| 靖江市| 乌苏市| 兴文县| 伊宁市| 黔东| 娱乐| 许昌市| 雅江县| 太谷县|