[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
Ïà¹ØÎĵµ£º
ASP.NET³£ÓõÄ6ÖÖÑéÖ¤¿Ø¼þ£¬ÈçÏ£º
RequiredFieldValidator £¨±ØÐë×Ö¶ÎÑéÖ¤£© ÓÃÓÚ¼ì²éÊÇ·ñÓÐÊäÈëÖµ
CompareValidator £¨±È½ÏÑéÖ¤£© °´É趨±È½ÏÁ½¸öÊäÈë
RangeValidator £¨·¶Î§ÑéÖ¤£© ÊäÈëÊÇ·ñÔÚÖ¸¶¨·¶Î§
RegularExpressionValidator £¨Õ ......
×÷Ϊһ¸ö³ÌÐòÔ±£¬ÔÚÍê³ÉÉè¼Æºó»¹Òª¸ù¾Ý³ÌÐòµÄÇé¿öÒÔ¼°Óû§µÄ·´Ó³²»¶Ï¶Ô³ÌÐò½øÐиĽø£¬ÕâÑù²ÅÄܲ»¶ÏµØÍêÉÆ×Ô¼ºµÄ×÷Æ·¡£±ÊÕßÔÚÖÆ×÷ÍêÈí¼þÉÌÎñÍøµÄÂÛ̳ºó£¬·¢ÏÖÈËÃÇ×Üϲ»¶ÔÚÌû×ÓÖмÓÉϸ÷ÖÖÓÐÓõÄURLÁ´½Ó»òEmailµØÖ·¡£¶ø±ÊÕßµ±³õÉè¼ÆʱûÓп¼Âǵ½ÕâÒ»µã£¬Ê¹µÃÕâЩURLÁ´½Ó»òEmailµØÖ·Ö»ÄÜÒÔÎÄ×ÖµÄÐÎʽ¶ø²¢²»ÊÇÒÔ³¬Á´½ÓµÄÐÎʽÏÔʾ ......
Ë®¾§±¨±í¿ÉÒÔÓɺܶàµÄ·½·¨µÃµ½£¬ÆäÖÐÒ»¸ö¾ÍÊÇʹÓÃVS.NetÀ´´´½¨£¬ËüÌṩÁ˷dz£·á¸»Ä£ÐÍÒÔʹÎÒÃÇÄܹ»ÔÚÔËÐÐʱ²Ù×÷ÊôÐԺͷ½·¨¡£Èç¹ûÄãÕýÔÚʹÓÃVS.Net¿ª·¢.Net³ÌÐò£¬ÄÇôÄã¾Í²»ÐèÒªÔÙ°²×°ÆäËüÈí¼þÁË£¬ÒòΪËûÒѾÄÚǶÔÚVS.NetÖÐÁË¡£
¡¡¡¡Óŵã:
¡¡¡¡VS.NetË®¾§±¨±íÓÐÏÂÃæһЩÖ÷ÒªµÄÓŵ㣺
¿ìËٵı¨±í¿ª·¢
Äܹ»µ¼³ö³ÉΪ¸´Ô ......
1. ÔÚASP.NETÖÐרÓÃÊôÐÔ£º
»ñÈ¡·þÎñÆ÷µçÄÔÃû£ºPage.Server.ManchineName
»ñÈ¡Óû§ÐÅÏ¢£ºPage.User
»ñÈ¡¿Í»§¶ËµçÄÔÃû£ºPage.Request.UserHostName
»ñÈ¡¿Í»§¶ËµçÄÔIP£ºPage.Request.UserHostAddress
2. ÔÚÍøÂç±à³ÌÖеÄͨÓ÷½·¨£º
»ñÈ¡µ±Ç°µçÄÔÃû£ºstatic System.Net.Dns.GetHostName()
¸ù¾ÝµçÄÔÃûÈ¡³öÈ«²¿IPµØÖ ......
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections;
using System.Data.SqlClient;
namespace DAL
{
/// <summary>
/// Êý¾Ý¿âµÄͨÓ÷ÃÎÊ´úÂë
/// ´ËÀàΪ³éÏóÀ࣬²»ÔÊÐíʵÀý»¯£¬ÔÚÓ¦Óà ......