[ת]dz̸.NETÖеÄÊý¾Ý°ó¶¨±í´ïʽ(¶þ)(3)
<%#Container.DataItem%> <%#GetDataItem()%> <%#Eval("×Ö¶ÎÃû")%> <%#DataBinder.Eval(Container.DataItem,"×Ö¶ÎÃû")%> <%#((DataRowView)Container.DataItem)["×Ö¶ÎÃû"] %> <%#((Type)Container.DataItem).³ÉÔ± %> <%#((Type)GetDataItem()).³ÉÔ± %>
1£¬Ð§ÂÊ×î¸ßÓ¦¸ÃÊÇ£º
<%#((Type)Container.DataItem).³ÉÔ± %>
<%#Container.DataItem%>
<%#((DataRowView)Container.DataItem)["×Ö¶ÎÃû"] %>
2£¬Ð§ÂÊÅŵڶþµÄÊÇ£º
<%#((Type)GetDataItem()).³ÉÔ± %>
<%#GetDataItem()%>
3£¬Ð§ÂÊ×îµÍµÄÊÇ£º
<%#Eval("×Ö¶ÎÃû")%>
<%#DataBinder.Eval(Container.DataItem,"×Ö¶ÎÃû")%>
ʹÓó¡ºÏ´ó¸ÅÈçÏ£º
1£¬
<%#Eval("×Ö¶ÎÃû")%>
<%#DataBinder.Eval(Container.DataItem,"×Ö¶ÎÃû")%>
Ëü
ÃǵÄʹÓó¡ºÏ×î¹ã£¬Êý¾ÝÔ´¿ÉÒÔΪÓëÊý¾Ý¿âÓйصÄDataSet£¬DataTable£¬DataView¡£Ò²¿ÉÒÔΪÆÕͨ¼¯ºÏ£¨ÀýÈ磺Êý
×飬ArrayList£¬HashTableµÈ)ºÍ·ºÐм¯ºÏ£¨Àý
È磺List<T>£¬Dictionary<Tkey,Tvalue>µÈ)¡£
×¢£ºËüÃÇ2¸öÓÀÔ¶¿ÉÒÔÏ໥Ìæ»»£¬ÖÁÉÙÄ¿Ç°ÊÇ
ÕâÑù£¬·²ÊÇ¿ÉÒÔÓÃEval·½·¨µÄµØ·½£¬¾Í¿ÉÒÔÓÃDataBinder.Eval·½·¨Ìæ»»¡£´ÓµÍ²ãʵÏÖÉÏ£¬Eval±ÈDataBinder.Eval·½·¨Ð§
ÂÊÉԵͣ¬ÔÒòÊÇEval·½·¨¶ÔÁ˵÷ÓÃGetDataItem()·½·¨ÕâÒ»²½¡£µ«×îÖÕ¶¼ÊÇͨ¹ýDataBinder.Eval·½·¨ÀûÓ÷´Éä¼¼Êõ¸ù¾ÝÃû³Æ²éÕÒ
ÊôÐÔ£¬´Ó¶ø¼ÆËã³ö±í´ïʽµÄÖµ£¬ËùÒԷdz£Ó°ÏìÐÔÄÜ¡£
2£¬
<%#((DataRowView)Container.DataItem)["×Ö¶ÎÃû"] %>
ËüÖ»ÄÜʹÓÃÔÚÊý¾ÝԴΪÓëÊý¾Ý¿âÓйصÄDataset£¬DatTable£¬DataView¡£ÕâЩÊý¾ÝÔ´¶¼ÊµÏÖÁËIListSource½Ó¿Ú¡£Æäʵ´ÓµÍ²ãʵÏÖ±¾ÖÊÉÏÀ´¿´£¬ËüºÍ<%#((Type)Container.DataItem).³ÉÔ± %>ÀàËÆ¡£
3,
<%#Container.DataItem%>
<%#GetDataItem()%>
<%#((Type)Container.DataItem).³ÉÔ± %>
<%#((Type)GetDataItem()).³ÉÔ± %>
Õâ
¼¸ÖÖÐÎʽ¹À¼Æ´ó¼Ò×î²»³£Óá£ËüÃÇÒ»°ãֻʹÓÃÓëÆÕͨ¼¯ºÏ£¨ÀýÈ磺Êý×飬ArrayList£¬HashTable)ºÍ·ºÐм¯ºÏ£¨Àý
È磺List<T>£¬Dictionary<Tkey,Tvalue>)¡£Æäʵ±¾ÖÊÉϾÍÊÇʵÏÖÁË
IList£¬ICollection£¬IEnumerable£¬IDictionaryµÈÒÔ¼°ÕâЩ½Ó¿Ú¶ÔÓ¦µÄ·ºÐнӿڵļ¯ºÏ¡£IList½Ó¿ÚºÍ
IDictionary½Ó¿ÚµÄÇø±ðÊÇ£¬Ò»¸öÖ»ÓÐÖµ£¬¶øÁíÒ»¸öÊǼü/Öµ¶Ô£¬¶ÔÓ¦·ºÐÐÐÎʽҲÊÇÕâÑù¡£¶øArray¾Í¶ÔÓÃList<T>£¬¶ø
HashTable¾Í¶ÔÓ¦Dictionary<Tkey,Tvalue>¡£
ÕâÀï¾ÙÀý<%#((Type)Container.DataItem).³ÉÔ± %>ÔÚRepeaterÖа󶨷ºÐÍList<T>µÄÓ÷¨£º
ºǫ́.cs´úÂ룺¶©µ¥ÉÌÆ·ÏîÄ£ÐÍ°ó¶¨repeater
ǰ̨.aspx´úÂ룺
ת×Ô£ºhttp://www.cnblogs.com/terryli/archive/2008/03/27/1125934.html List<Model.OrderItems> listOrderItmes = new DAl.OrderItemsDAO().GetListArray("OrderId = '" + orderId + "' order by Id desc");
repList.DataSource = listOrderItmes;
repList.DataBind();
<asp:Repeater ID="repList" runat="server">
<ItemTemplate>
<tr>
<td class="td02"><a href='productcon.aspx?id=<%#Eval("ProductId") %>' target="_blank"><%#Eval("ProductName") %></a></td>
<td align="right" valign="middle" class="td02">£¤<%#((Model.OrderItems)Container.DataItem).UnitPrice %></td>
<td valign="middle" class="td02 colorgreg"><%#((Model.OrderItems)Container.DataItem).Quantity%></td>
<td align="right" class="td02">£¤<%#((Model.OrderItems)Container.DataItem).TotalPrice %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
ÍƼöÐÅÏ¢
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- Asp.net MVCÔ´Âë·ÖÎö--Model Validation(Se....
- .Net À¬»ø»ØÊÕ»úÖÆÔÀíºÍËã·¨£¨Ò»£©
- .netʵÌåнâ
- ·ÖÎöASP.NET¶ÁÈ¡XMLÎļþ4ÖÖ·½·¨
- »ñÈ¡ÍøÕ¾ËõÂÔͼ´úÂë
- Asp.net ¸ù¾ÝIPµØÖ·»ñÈ¡¿çÍø¶ÎmacµØÖ·º¯Êý¡¾ËѲء¿
- ¹ýÂËÃô¸Ð¹Ø¼ü×Ö¡£
- Éú³ÉÖ¸¶¨Î»ÊýµÄËæ»ú×Ö·û´®
- ¿Í»§¶Ë»ñÈ¡MACµØÖ·£¬µ½·þÎñÆ÷ÑéÖ¤
- ²½²½ÎªÓª .NETÈý²ã¼Ü¹¹½âÎö ¶þ¡¢Êý¾Ý¿âÉè¼Æ
ÆÀÂÛ