91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

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

广宗县| 商南县| 北辰区| 凯里市| 庄浪县| 上林县| 喜德县| 仙游县| 叶城县| 南昌市| 资讯| 广丰县| 策勒县| 青阳县| 子长县| 庄河市| 万载县| 鄱阳县| 嵩明县| 方山县| 冷水江市| 剑川县| 巴南区| 新竹县| 焉耆| 赤水市| 金沙县| 屯昌县| 个旧市| 津市市| 修水县| 北宁市| 中西区| 南康市| 沙河市| 灌阳县| 饶平县| 永嘉县| 丹寨县| 扬中市| 洞口县|