最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp.net實(shí)現(xiàn)DataList與Repeater嵌套綁定的方法

 更新時間:2016年04月20日 11:45:12   作者:且行且思  
這篇文章主要介紹了asp.net實(shí)現(xiàn)DataList與Repeater嵌套綁定的方法,結(jié)合實(shí)例形式分析了DataList與Repeater的步驟與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下

本文實(shí)例講述了asp.net實(shí)現(xiàn)DataList與Repeater嵌套綁定的方法。分享給大家供大家參考,具體如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="home.aspx.cs" Inherits="home" %>
<body>
  <form id="form1" runat="server">
       <asp:DataList ID="monitorTypeList" runat="server" RepeatColumns="4" 
         onitemdatabound="monitorTypeList_ItemDataBound" RepeatDirection="Horizontal" ItemStyle-VerticalAlign="Top">
       <ItemTemplate>
        <table class="conBox" width="186" border="0" cellpadding="0" cellspacing="1" style="margin-right:10px;">
         <tr>
          <th><a href="<%#Eval("plugpath") %>"><%#Eval("monitor_type_name") %></a></th>
         </tr>
         <asp:Repeater ID="monitorConfigList" runat="server">
          <ItemTemplate>
         <tr>
          <td><a href="<%#Eval("plugpath") %>?monitor_id=<%#Eval("monitor_id") %>"><%#Eval("monitor_name") %></a></td>
         </tr>
          </ItemTemplate>
         </asp:Repeater>
        </table>
      </ItemTemplate>
      </asp:DataList>
  </form>
</body>

home.aspx.cs

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class home : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    myCheck.IsLoginNonReturn();
    if (!IsPostBack)
    {
      Bind_monitorTypeList();
    }
  }
  protected void Bind_monitorTypeList()
  {
    string sql = "select monitor_type_id,monitor_type_name from monitor_type";
    DbConn conn = new DbConn();
    DataSet ds = conn.DataSet(sql,"monitor_type");
    monitorTypeList.DataSource = ds.Tables[0];
    monitorTypeList.DataBind();
    ds.Dispose();
    conn.Close();
  }
  protected void monitorTypeList_ItemDataBound(object sender, DataListItemEventArgs e)
  {
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
      string monitor_type_id = ((DataRowView)e.Item.DataItem).Row["monitor_type_id"].ToString();
      Repeater monitorConfigList = (Repeater)e.Item.FindControl("monitorConfigList");
      if (monitorConfigList != null)
      {
        string sql = "select monitor_id,nonitor_name,plugpath from monitor where monitor_type_id=" + monitor_type_id;
        DbConn conn = new DbConn();
        DataSet ds = conn.DataSet(sql, "monitor");
        monitorConfigList.DataSource = ds.Tables[0];
        monitorConfigList.DataBind();
        ds.Dispose();
        conn.Close();
      }
    }
  }
}

更多關(guān)于asp.net相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《asp.net文件操作技巧匯總》、《asp.net ajax技巧總結(jié)專題》及《asp.net緩存操作技巧總結(jié)》。

希望本文所述對大家asp.net程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • ASP.net全局程序文件Global.asax用法分析

    ASP.net全局程序文件Global.asax用法分析

    這篇文章主要介紹了ASP.net全局程序文件Global.asax用法,較為詳細(xì)分析了Global.asax文件中幾個常見選項(xiàng)的含義及用法,需要的朋友可以參考下
    2014-10-10
  • .NET使用RSA加密解密的方法

    .NET使用RSA加密解密的方法

    這篇文章主要為大家詳細(xì)介紹了.NET使用RSA加密解密的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-03-03
  • 異步調(diào)用webservice返回responseXML為空的問題解決方法

    異步調(diào)用webservice返回responseXML為空的問題解決方法

    異步調(diào)用webservice返回responseXML為空,詳細(xì)很多朋友都遇到過類似的問題吧,接下來為大家提供詳細(xì)的解決方案,感興趣的朋友可以參考下哈
    2013-04-04
  • ASP.NET Core 使用Cookie驗(yàn)證身份的示例代碼

    ASP.NET Core 使用Cookie驗(yàn)證身份的示例代碼

    這篇文章主要介紹了ASP.NET Core 使用Cookie驗(yàn)證身份的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • Asp.net中將Word文件轉(zhuǎn)換成HTML的方法

    Asp.net中將Word文件轉(zhuǎn)換成HTML的方法

    這篇文章主要介紹了Asp.net中將Word文件轉(zhuǎn)換成HTML的方法,需要的朋友可以參考下
    2014-08-08
  • 手把手教你mvc導(dǎo)入excel

    手把手教你mvc導(dǎo)入excel

    這篇文章主要為大家詳細(xì)介紹了手把手教你mvc導(dǎo)入excel的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-12-12
  • ASP.NET Core WebAPI實(shí)現(xiàn)本地化(單資源文件)

    ASP.NET Core WebAPI實(shí)現(xiàn)本地化(單資源文件)

    這篇文章主要介紹了ASP.NET Core WebAPI實(shí)現(xiàn)本地化(單資源文件),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • asp.net分頁功能實(shí)現(xiàn)

    asp.net分頁功能實(shí)現(xiàn)

    這篇文章主要介紹了asp.net分頁功能是如何實(shí)現(xiàn)的,有整個解析思路,希望對大家的學(xué)習(xí)有所幫助。
    2015-09-09
  • mvc file控件無刷新異步上傳操作源碼

    mvc file控件無刷新異步上傳操作源碼

    這篇文章主要為大家分享了mvc file控件無刷新異步上傳操作源碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-10-10
  • asp.net下XML的加密和解密實(shí)現(xiàn)方法

    asp.net下XML的加密和解密實(shí)現(xiàn)方法

    xml加密(XML Encryption)是w3c加密xml的標(biāo)準(zhǔn)。這個加密過程包括加密xml文檔的元素及其子元素,通過加密,xml的初始內(nèi)容將被替換,但其xml格式仍然被完好的保留。
    2010-02-02

最新評論

漳浦县| 六安市| 桐柏县| 长岭县| 岳西县| 丽江市| 遂昌县| 二连浩特市| 兰西县| 涞源县| 于田县| 花莲县| 虹口区| 南陵县| 徐汇区| 衡南县| 于都县| 林西县| 梓潼县| 湖南省| 乌兰浩特市| 南投县| 德惠市| 垫江县| 且末县| 贵定县| 兴国县| 九龙坡区| 白山市| 宜章县| 大埔县| 林口县| 清远市| 临沭县| 阜新市| 太和县| 海门市| 绥宁县| 龙山县| 宿松县| 乌拉特后旗|