濮阳杆衣贸易有限公司

主頁 > 知識庫 > Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決

Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決

熱門標簽:廈門四川外呼系統(tǒng) 內(nèi)蒙古智能電銷機器人哪家強 百度地圖標注點擊事件 濟源人工智能電話機器人價格 山東防封電銷卡辦理套餐 怎樣在地圖標注消火栓圖形 地圖標注位置多的錢 泰州手機外呼系統(tǒng)軟件 杭州智能電話機器人
.aspx頁面代碼
復制代碼 代碼如下:

asp:Repeater ID="Repeater1" runat="server">
ItemTemplate>
%# ((KeyValuePairint, ListUser>>)Container.DataItem).Key %> br />
asp:Repeater ID="Repeater2" runat="server" DataSource='%# ((KeyValuePairint, ListUser>>)Container.DataItem).Value %>'>
ItemTemplate>
%# (Container.DataItem as User).Id %>
%# (Container.DataItem as User).Name %>
/ItemTemplate>
/asp:Repeater>
hr />
/ItemTemplate>
/asp:Repeater>

.aspx.cs后置代碼
復制代碼 代碼如下:

public partial class Temp : System.Web.UI.Page
{
Dictionaryint, ListUser>> dict = new Dictionaryint, ListUser>>();
protected void Page_Load(object sender, EventArgs e)
{
dict.Add(1, new ListUser>
{
new User{Id = 1, Name = "aa"}
,new User{Id = 2, Name = "bb"}
});
dict.Add(2, new ListUser>
{
new User{Id = 3, Name = "cc"}
,new User{Id = 4, Name = "dd"}
});
Repeater1.DataSource = dict;
Repeater1.DataBind();
}
}
public class User
{
public int Id{get;set;}
public string Name{get;set;}
}

如果報以下錯誤:
repeater 使用的是無效數(shù)據(jù)源。有效數(shù)據(jù)源必須實現(xiàn) IListSource 或 IEnumerable?
是因為數(shù)據(jù)源類型問題,比如 DataTable DataSet Xml Arrry 集合
像 String int 對象 這樣的類型是不能直接作為它的數(shù)據(jù)源的,尤其要注意對象引起的問題
您可能感興趣的文章:
  • Repeater事件OnItemCommand取得行內(nèi)控件的方法
  • Repeater控件與PagedDataSource結(jié)合實現(xiàn)分頁功能
  • Repeater控件實現(xiàn)編輯、更新、刪除等操作示例代碼
  • Repeater怎么實現(xiàn)多行間隔顯示分隔符
  • Repeater中嵌套Repeater的示例介紹
  • repeater做刪除前彈窗詢問實例
  • 給Repeater控件里添加序號的5種才常見方法介紹
  • asp.net Repeater 數(shù)據(jù)綁定的具體實現(xiàn)(圖文詳解)
  • .net JS模擬Repeater控件的實現(xiàn)代碼
  • Repeater控件綁定的三種方式
  • 利用js的Node遍歷找到repeater的一個字段實例介紹
  • ASP.NET筆記之 Repeater的使用
  • asp.net Repeater分頁實例(PageDataSource的使用)
  • asp.net中使用repeater和PageDataSource搭配實現(xiàn)分頁代碼
  • Repeater里switch的使用方法
  • Repeater控件動態(tài)變更列(Header,Item和Foot)信息(重構(gòu)cs)
  • Repeater的FooterTemplate顯示某列總計思路與代碼
  • 嵌套repeater示例分享

標簽:洛陽 新鄉(xiāng) 朔州 朝陽 百色 喀什 周口 臺州

巨人網(wǎng)絡(luò)通訊聲明:本文標題《Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決》,本文關(guān)鍵詞  Repeater,綁定,dictionary,數(shù)據(jù),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決》相關(guān)的同類信息!
  • 本頁收集關(guān)于Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    稻城县| 贺兰县| 花垣县| 麻江县| 巴塘县| 遂溪县| 辽宁省| 囊谦县| 文登市| 松江区| 延安市| 施秉县| 固安县| 鄱阳县| 八宿县| 乌拉特中旗| 武功县| 新绛县| 吉林市| 新沂市| 清流县| 项城市| 惠州市| 韶山市| 泽普县| 江安县| 获嘉县| 鄂尔多斯市| 阜南县| 仁布县| 当阳市| 含山县| 榆社县| 普宁市| 柳河县| 彭泽县| 合阳县| 铁岭县| 射阳县| 新龙县| 望谟县|