asp.netÊý¾Ý°ó¶¨Ö®EvalºÍBind ºÍµÈÇø±ð
EvalÊÇasp.net1.1Öг£
Óõİó¶¨Óï·¨£¬ËüÊÇ“µ¥Ïò”µÄ£¬¼´°ó¶¨Ê±°ÑÊý¾ÝÔ´ÉÏÏàÓ¦µÄÖµ¸³µ½¸Ã¿Ø¼þÉÏ£¬EvalµÄÈÎÎñ¾ÍÍê³ÉÁË
¶øBindËùνµÄ“Ë«Ïò”¾ÍÊÇ£ºÔÚ°ó¶¨Ê±£¬°Ñ
Êý¾ÝÔ´ÉÏÏàÓ¦µÄÖµ¸³µ½¸Ã¿Ø¼þÉÏ£¬²¢ÇÒ£¬ÔÚÌύʱ£¬×Ô¶¯ÌáÈ¡Óû§ÔڸÿؼþÉÏÊäÈëµÄÖµ¡£
Code
<
EditItemTemplate
>
<
asp:Label
ID
="CityIDLabel1"
runat
="server"
Text
='<%#
Eval("CityID") %
>
'>
</
asp:Label
>
<
asp:TextBox
ID
="CityTextBox"
runat
="server"
Text
='<%#
Bind("City") %
>
'>
</
asp:TextBox
>
</
EditItemTemplate
>
ÓÖÀý£º
Eval£º°ó¶¨µÄÊÇÖ»¶ÁÊý¾ÝµÄÏÔ
ʾ£»Bind£º¿ÉÒÔ°ó¶¨Ö»¶ÁÊý¾ÝÒ²¿ÉÒ԰󶨸üÐÂÊý¾Ý£¬Bind·½·¨»¹°Ñ×ֶκͿؼþµÄ°ó¶¨ÊôÐÔÁªÏµÆðÀ´£¬Ê¹µÃÊý¾Ý¿Ø¼þ£¨±ÈÈçGridViewµÈ£©µÄ
Update¡¢InsertºÍDeleteµÈ·½·¨¿ÉÒÔʹÓÃÕâÖÖÁªÏµÀ´×÷³öÏàÓ¦µÄ´¦Àí¡£
Eval ºÍ Bind°ó¶¨µÄÊý¾ÝÔÚ<%#
%> ÏÔʾ£¬ Èô¶ÔÒªÏÔʾµÄÊý¾Ý×÷Ð޸ĻòÕß²Ù×÷Ò²ÔÚ<%# %> ÖУ¬ÀýÈ磺
1£¬ ¶ÔÏÔʾµÄ×Ö·û´®×÷×Ö·ûÏÔʾ:
<%
# (
Eval
(
"
Address
"
)).ToString().SubString(
0
,
10
)
%>
ÏÔ
ʾ10λÊýµÄµØÖ·¡£
2£¬ ¶ÔÏÔʾµÄÐÅÏ¢×÷ÅжÏ:
<%
# (
Eval
(
"
if_delete
"
)).ToString
==
"
yes
"
?
"
ÒÑɾ
³ý
"
:
"
δɾ³ý
"
%>
--------------------------------------------------------------------------------------------------------------------------------
<% %> An embedded code block is server code that executes during
the page's render phase. The code in the block can execute programming
statements and call functions in the current page class.
http://msdn2.microsoft.com/en-gb/library/ms178135(vs.80).aspx
<%=
%> most useful for displaying single pieces of information.
http://msdn2.microsof
Ïà¹ØÎĵµ£º
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web ......
Asp.net³£ÓõÄ51¸ö´úÂë(·Ç³£ÊµÓÃ)
1.//µ¯³ö¶Ô»°¿ò.µã»÷תÏòÖ¸¶¨Ò³Ãæ
CODE:Response.Write("<script>window.alert('¸Ã»áԱûÓÐÌá½»ÉêÇë,ÇëÖØÐÂÌá½»£¡')</script>");
Response.Write("<script>window.location ='http://www.51aspx.com/bizpulic/upmeb.aspx'</script>");
2. ......
ASP.NETÒ³ÃæÓëIISµ×²ã½»»¥ºÍ¹¤×÷ÔÀíÏê½â
µÚÒ»»Ø£º
ÒýÑÔ
ÎÒ²éÔĹý²»ÉÙAsp.NetµÄÊé¼®£¬·¢ÏÖ´ó¶àÊý×÷Õß¶¼ÊÇÕ¾ÔÚÒ»¸ö±È½Ï¸ßµÄ²ã´ÎÉϽ²½âAsp.Net¡£ËûÃÇÄÍÐÄ¡¢Ï¸ÖµظæËßÄãÈçºÎÒ»²½²½ÍϷſؼþ¡¢ÉèÖÿؼþÊôÐÔ¡¢±àдCodeBehind´úÂ룬ÒÔʵÏÖij¸öÌØ¶¨µÄ¹¦ÄÜ¡£
ÕâÖÖ×ö·¨£¬Êµ¼ÊÉÏÊǻشðÁË“ÈçºÎÈ¥×ö”µÄÎÊÌ⣬ȴà ......
aspxÒ³Ãæ´úÂë
<head runat="server">
<%-- <title>ÈýÑ¸ÍøÂç</title>--%>
<asp:Literal ID="ltPageTitle" runat="server"/>
<asp:Literal ID="ltPagekeywords" runat="server" />
<asp:Literal ID="ltPagedescription" runat="server" />
&n ......