佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > repeater 分列顯示以及布局的實例代碼

repeater 分列顯示以及布局的實例代碼

熱門標簽:電子圍欄 銀行業(yè)務 團購網(wǎng)站 阿里云 Mysql連接數(shù)設置 科大訊飛語音識別系統(tǒng) Linux服務器 服務器配置

前臺

復制代碼 代碼如下:

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是一行顯示列數(shù)

            {

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

            }

            i++;

        }


您可能感興趣的文章:
  • Repeater的FooterTemplate顯示某列總計思路與代碼
  • Repeater控件動態(tài)變更列(Header,Item和Foot)信息實現(xiàn)思路
  • Repeater對數(shù)據(jù)進行格式化處理
  • Repeater全選刪除和分頁實現(xiàn)思路及代碼
  • ASP.NET中repeater嵌套實現(xiàn)代碼(附源碼)
  • Repeater與ListView功能概述及使用介紹
  • Repeater控件數(shù)據(jù)導出Excel(附演示動畫)
  • asp.net中讓Repeater和GridView支持DataPager分頁
  • 在jquery repeater中添加設置日期,下拉,復選框等控件
  • Repeater控件動態(tài)變更列(Header,Item和Foot)信息(重構cs)

標簽:蚌埠 衢州 江蘇 大理 衡水 棗莊 萍鄉(xiāng) 廣元

巨人網(wǎng)絡通訊聲明:本文標題《repeater 分列顯示以及布局的實例代碼》,本文關鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    涿州市| 金寨县| 颍上县| 民勤县| 宣武区| 宁海县| 冀州市| 东宁县| 华坪县| 于田县| 南雄市| 景宁| 海丰县| 驻马店市| 汾阳市| 东莞市| 定州市| 乌拉特前旗| 屏东市| 德清县| 洪江市| 伽师县| 南通市| 天门市| 阿坝县| 邻水| 从江县| 伽师县| 罗平县| 保定市| 韩城市| 太和县| 疏勒县| 芦山县| 鄂托克前旗| 健康| 平利县| 德江县| 本溪| 新乐市| 三明市|