[ASP.NET]DataBinder.EvalÓ÷¨
<%# Bind("Subject") %> //°ó¶¨×Ö¶Î
<%# Container.DataItemIndex + 1%> //ʵÏÖ×Ô¶¯±àºÅ
<%# DataBinder.Eval(Container.DataItem, "[n]") %>
ͨ³£Ê¹Óõķ½·¨
<%# DataBinder.Eval(Container.DataItem, "ColumnName") %>
<%# DataBinder.Eval(Container.DataItem, "ColumnName", null) %>
<%# DataBinder.Eval(Container, "DataItem.ColumnName", null) %>
ÆäËûÓ÷¨
<%# ((DataRowView)Container.DataItem)["ColumnName"] %>
<%# ((DataRowView)Container.DataItem).Row["ColumnName"] %>
<%# ((DataRowView)Container.DataItem)["adtitle"] %>
<%# ((DataRowView)Container.DataItem)[n] %>
<%# ((DbDataRecord)Container.DataItem)[0] %>
<%# (((×Ô¶¨ÒåÀàÐÍ)Container.DataItem)).ÊôÐÔ.ToString() %>//Èç¹ûÊôÐÔΪ×Ö·û´®ÀàÐ;Ͳ»ÓÃToString()ÁË
DataBinder.EvalÓ÷¨·¶Àý
<%# DataBinder.Eval(Container.DataItem, "IntegerValue", "{0:c}") %>
¸ñʽ»¯×Ö·û´®²ÎÊýÊÇ¿ÉÑ¡µÄ¡£Èç¹ûºöÂÔ²ÎÊý£¬DataBinder.Eval ·µ»Ø¶ÔÏóÀàÐ͵ÄÖµ£¬
//ÏÔʾ¶þλСÊý
<%# DataBinder.Eval(Container.DataItem, "UnitPrice", " pan style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">${0:F2}") %>
//{0:G}´ú±íÏÔʾTrue»òFalse
<ItemTemplate>
<asp:Image Width="12" Height="12" Border="0" runat="server"
AlternateText=''<%# DataBinder.Eval(Container.DataItem, "Discontinued", "{0:G}") %>''
ImageUrl=''<%# DataBinder.Eval(Container.DataItem, "Discontinued", "~/images/{0:G}.gif") %>'' />
</ItemTemplate>
//ת»»ÀàÐÍ
((string)DataBinder.Eval(Container, "DataItem.P_SHIP_TIME_SBM8")).Substring(4,4)
{0:d} ÈÕÆÚÖ»ÏÔʾÄêÔÂÈÕ
{0:yyyy-mm-dd} °´¸ñʽÏÔʾÄêÔÂÈÕ
{0:c} »õ±ÒÑùʽ
<%#Container.DataItem("price","{0:£¤#,##0.00}")%>
<%# DataBinder.Eval(Container.DataItem,"Company_Ureg_Date","{0:yyyy-M-d}")%>
Specifier Type Format Output (Passed Double 1.42) Output (Passed Int -12400)
c Currency {0:c} $1.42 &nb
Ïà¹ØÎĵµ£º
Ò»¡¢Èý²ãÌåϵ¼Ü¹¹¡¡¡¡1.±íʾ²ã(USL)£ºÖ÷Òª±íʾWEB·½Ê½£¬Ò²¿ÉÒÔ±íʾ³ÉWINFORM·½Ê½¡£Èç¹ûÂß¼²ãÏ൱ǿ´óºÍÍêÉÆ£¬ÎÞÂÛ±íÏÖ²ãÈçºÎ¶¨ÒåºÍ¸ü¸Ä£¬Âß¼²ã¶¼ÄÜÍêÉƵØÌṩ·þÎñ¡£
¡¡¡¡2.ÒµÎñÂß¼²ã(BLL)£ºÖ÷ÒªÊÇÕë¶Ô¾ßÌåµÄÎÊÌâµÄ²Ù×÷£¬Ò²¿ÉÒÔÀí½â³É¶ÔÊý¾Ý²ãµÄ²Ù×÷£¬¶ÔÊý¾ÝÒµÎñÂß¼´¦Àí¡£Èç¹û˵Êý¾Ý²ãÊÇ»ýľ£¬ÄÇÂß¼²ã¾ÍÊǶÔÕâЩ»ýľµÄ ......
1¡¢DateTime Êý×ÖÐÍ
ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
System.DateTime currentTime=new System.DateTime();
1.1 È¡µ±Ç°ÄêÔÂÈÕʱ·ÖÃë currentTime=System.DateTime.Now;
1.2 È¡µ±Ç°Äê int Äê=currentTime.Year;
1.3 È¡µ±Ç°Ô int ÔÂ=currentTime.Month;
1.4 È¡µ±Ç°ÈÕ int ÈÕ=currentTime.Day;
1.5 È¡µ±Ç°Ê± int ʱ=currentTi ......
ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......
ASP.NETÉú³É¾²Ì¬Ò³
ºËÐļ¼Êõ£º
HTMLPageÎļþ¼Ð£¬ModelHTML.htmÎļþÖеÄArticleTitle,ArticleContent¶¼ÊÇÒªÌæ»»µÄÇøÓò
WriteFile(dr["ArticleTitle"].ToString(), dr["ArticleContent"].ToString(), dr["ID"].ToString());
1.ǰ̨
<head runat="server">
<title>ASP.NETÉú³É¾²Ì¬ÍøÒ³</title>
& ......
¹«Ë¾ÒªÇ󿪷¢Ò»¸ö¼Ì³ÐSystem.Windows.Forms.ListViewÀàµÄ×é¼þ£¬ÒªÇó´ïµ½ÒÔϵÄÌØÊ⹦ÄÜ£ºµã»÷ListView¸÷ÁÐÁÐͷʱ£¬ÄÜ°´ÕÕµã»÷ÁеÄÿÐÐÖµ½øÐÐÖØÅÅÊÓͼÖеÄËùÓÐÐÐ (ÅÅÐòµÄ·½Ê½ÈçDataGridÏàËÆ)¡£¸ù¾ÝÄúµÄ֪ʶ£¬Çë¼òҪ̸һÏÂÄúµÄ˼· £¿
Ö±½Ó·ÅÉÏ´úÂ룺
using System;
using System.Collections.Generic;
using System.Comp ......