做爰高潮a片〈毛片〉,尤物av天堂一区二区在线观看,一本久久A久久精品VR综合,添女人荫蒂全部过程av

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

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

來源:懂視網(wǎng) 責編:小采 時間:2020-11-27 22:41:13
文檔

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

Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決:.aspx頁面代碼 代碼如下:<asp:Repeater ID=Repeater1 runat=server> <ItemTemplate> <%# ((KeyValuePair<int, List<User>>)Container.DataItem).Key %> <br
推薦度:
導讀Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決:.aspx頁面代碼 代碼如下:<asp:Repeater ID=Repeater1 runat=server> <ItemTemplate> <%# ((KeyValuePair<int, List<User>>)Container.DataItem).Key %> <br

.aspx頁面代碼
代碼如下:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%# ((KeyValuePair<int, List<User>>)Container.DataItem).Key %> <br />
<asp:Repeater ID="Repeater2" runat="server" DataSource='<%# ((KeyValuePair<int, List<User>>)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
{
Dictionary<int, List<User>> dict = new Dictionary<int, List<User>>();
protected void Page_Load(object sender, EventArgs e)
{
dict.Add(1, new List<User>
{
new User{Id = 1, Name = "aa"}
,new User{Id = 2, Name = "bb"}
});
dict.Add(2, new List<User>
{
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ù)源的,尤其要注意對象引起的問題

聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

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

Repeater綁定dictionary數(shù)據(jù)源代碼及報錯解決:.aspx頁面代碼 代碼如下:<asp:Repeater ID=Repeater1 runat=server> <ItemTemplate> <%# ((KeyValuePair<int, List<User>>)Container.DataItem).Key %> <br
推薦度:
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 彭阳县| 鹤峰县| 吉隆县| 隆安县| 景德镇市| 铜鼓县| 南溪县| 利津县| 德清县| 全州县| 敦煌市| 通许县| 汾西县| 松江区| 资中县| 河间市| 新田县| 昭苏县| 昌宁县| 南康市| 岑巩县| 班戈县| 泸水县| 潜江市| 子洲县| 阜城县| 德令哈市| 澳门| 三门县| 武陟县| 西华县| 始兴县| 兰坪| 石家庄市| 城步| 若尔盖县| 武鸣县| 镇平县| 永兴县| 威宁| 霍林郭勒市|