BindºÍEvalµÄ²»Í¬Ó÷¨ (asp.net C#)
½ñÌìÔÚÓÃDataListµÄÄ£°åÁеÄʱºòÏ°¹ßÐÔµØÏñÔÚ03ÖÐÄÇÑùÈ¥¸øÄ£°åÁеİó¶¨×ֶμӸö´¦Àíº¯Êý£º
< asp:Label ID = " Label1 " runat = " server " Text = ' <%#ConvertState(Bind("Status"))%> ' ></ asp:Label >
¿ÉÊǾ¹È»³ö´í£ºµ±Ç°ÉÏÏÂÎÄÖв»´æÔÚÃû³Æ“Bind” ¡£
ºóÀ´ÓÖÏ°¹ßÐÔµØÏë°Ñ°ó¶¨×ֶ奶ÀÄóöÀ´ÏÔʾ£¬ÓÖÌáʾ£º¾¯¸æ 2 Éè¼ÆÆ÷ÎļþÉú³Éʧ°Ü: ±ØÐ뽫¶Ô Bind µÄµ÷Ó÷ÖÅä¸øÄ£°åÖеĿؼþµÄÊôÐÔ¡£ ¸Ð¾õºÜÓôÃÆ£¬ÓÚÊÇ°ÑBind»»³ÉEvalÒ»µãÎÊÌⶼûÁË¡£
< asp:Label ID = " Label1 " runat = " server " Text = ' <%#ConvertState(Eval("Status"))%> ' ></ asp:Label >
ÉÏÍø²éһϲŷ¢ÏÖ¶þÕßµÄÇø±ð£º
eval()·½·¨ÔÚÔËÐÐʱʹÓ÷´ÉäÖ´ÐкóÆڰ󶨼ÆË㣬Òò´ËÓë±ê×¼µÄASP.NETÊý¾Ý°ó¶¨·½·¨bindÏà±È£¬»áµ¼ÖÂÐÔÄÜÃ÷ÏÔϽµ¡£ËüÒ»°ãÓÃÔÚ°ó¶¨Ê±ÐèÒª¸ñʽ»¯×Ö·û´®µÄÇé¿öÏ¡£¶àÊýÇé¿ö¾¡Á¿ÉÙÓô˷½·¨
Eval ·½·¨ÊǾ²Ì¬£¨Ö»¶Á£©·½·¨£¬¸Ã·½·¨²ÉÓÃÊý¾Ý×ֶεÄÖµ×÷Ϊ²ÎÊý²¢½«Æä×÷Ϊ×Ö·û´®·µ»Ø¡£Bind ·½·¨Ö§³Ö¶Á/д¹¦ÄÜ£¬¿ÉÒÔ¼ìË÷Êý¾Ý°ó¶¨¿Ø¼þµÄÖµ²¢½«Èκθü¸ÄÌá½»»ØÊý¾Ý¿â¡£
ʹÓà Eval ·½·¨
Eval ·½·¨¿É¼ÆËãÊý¾Ý°ó¶¨¿Ø¼þ£¨Èç GridView¡¢DetailsView ºÍ FormView ¿Ø¼þ£©µÄÄ£°åÖеĺóÆÚ°ó¶¨Êý¾Ý±í´ïʽ¡£ÔÚÔËÐÐʱ£¬Eval ·½·¨µ÷Óà DataBinder ¶ÔÏóµÄ Eval ·½·¨£¬Í¬Ê±ÒýÓÃÃüÃûÈÝÆ÷µÄµ±Ç°Êý¾ÝÏî¡£ÃüÃûÈÝÆ÷ͨ³£ÊÇ°üº¬ÍêÕû¼Ç¼µÄÊý¾Ý°ó¶¨¿Ø¼þµÄ×îС×é³É²¿·Ö£¬Èç GridView ¿Ø¼þÖеÄÒ»ÐС£Òò´Ë£¬Ö»ÄܶÔÊý¾Ý°ó¶¨¿Ø¼þµÄÄ£°åÄڵİó¶¨Ê¹Óà Eval ·½·¨¡£
Eval ·½·¨ÒÔÊý¾Ý×ֶεÄÃû³Æ×÷Ϊ²ÎÊý£¬´ÓÊý¾ÝÔ´µÄµ±Ç°¼Ç¼·µ»ØÒ»¸ö°üº¬¸Ã×Ö¶ÎÖµµÄ×Ö·û´®¡£¿ÉÒÔÌṩµÚ¶þ¸ö²ÎÊýÀ´Ö¸¶¨·µ»Ø×Ö·û´®µÄ¸ñʽ£¬¸Ã²ÎÊýΪ¿ÉÑ¡²ÎÊý¡£×Ö·û´®¸ñʽ²ÎÊýʹÓÃΪ String ÀàµÄ Format ·½·¨¶¨ÒåµÄÓï·¨¡£
ʹÓà Bind ·½·¨
Bind ·½·¨Óë Eval ·½·¨ÓÐһЩÏàËÆÖ®´¦£¬µ«Ò²´æÔںܴóµÄ²îÒì¡£ËäÈ»¿ÉÒÔÏñʹÓà Eval ·½·¨Ò»ÑùʹÓà Bind ·½·¨À´¼ìË÷Êý¾Ý°ó¶¨×ֶεÄÖµ£¬µ«µ±Êý¾Ý¿ÉÒÔ±»ÐÞ¸Äʱ£¬»¹ÊÇҪʹÓà Bind ·½·¨¡£
ÔÚ ASP.NET ÖУ¬Êý¾Ý°ó¶¨¿Ø¼þ£¨Èç GridView¡¢DetailsView ºÍ FormView ¿Ø¼þ£©¿É×Ô¶¯Ê¹ÓÃÊý¾ÝÔ´¿Ø¼þµÄ¸üС¢É¾³ýºÍ²åÈë²Ù×÷¡£ÀýÈ磬Èç¹ûÒÑΪÊý¾ÝÔ´¿Ø¼þ¶¨ÒåÁË SQL Select¡¢Insert¡¢Delete ºÍ Update Óï¾ä£¬Ôòͨ¹ýʹÓà GridView¡¢DetailsView »ò Form
Ïà¹ØÎĵµ£º
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
¡¡¡¡´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)£¼/script£¾")
¡¡¡¡½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
¡¡¡¡2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......
н¨Ò»¸öĬÈϵÄASP.NET MVC2Ó¦ÓóÌÐò£¬ÏµÍ³»áĬÈϵÄÉú³É°üº¬»ù±¾¹¦ÄܵÄÓ¦ÓóÌÐò£¬²é¿´ÕâЩÉú³ÉµÄ´úÂ룬¿É°ïÖúÎÒÃÇÀí½âASP.NET MVC2¡£ÏÂÃæÊǶÔURL·ÓɵÄÀí½â£¬ÒÔ±¸Íü¡£
Ò»¡¢Global.asax.csÖеĴúÂ룺
public class MvcApplication : System.Web.HttpApplication
{
&n ......
asp.net ajaxÖÐÎÄÂÒÂëµÄ½â¾ö£¿
2010-01-19 12:06
ÒÔǰûÔõô×ÐϸµÄÑо¿¹ýajax,Ö»ÊÇÓõ½Á˾ÍÖ±½ÓÄùýÀ´ÓÃ,·¢ÏÖÁËÎÊÌâÔÙÕÒ½â¾ö·½·¨.ÒÔÏÂÊÇÎÒÔÚÕÒ½â¾öÎÊÌâµÄ¹ý³ÌÖеÄÒ»µãССµÄ×ܽá.
Ò».̸AjaxµÄGetºÍPostµÄÇø±ð
Get·½Ê½:
ÓÃget·½Ê½¿É´«Ëͼòµ¥Êý¾Ý£¬µ«´óСһ°ãÏÞÖÆÔÚ1KBÏ£¬Êý¾Ý×·¼Óµ½urlÖз¢Ë ......
±¾ÎĽ«Ì½ÌÖasp.netÏÂʵÏÖÎļþÉÏ´©½ø¶ÈÌõµÄ·½·¨¡£
Ò»°ãÇé¿öÏ£¬ÒªÊµÏÖÉÏ´«½ø¶ÈÌõÊ×ÏÈҪʵÏÖÉÏ´«Îļþ·Ö¿é¶ÁÈ¡£¬¶øĬÈÏÇé¿öÏ£¬iis½«Ö±½Ó°ÑÉÏ´«µÄÎļþÒ»´Î¶ÁÈëµ½ÄÚ´æÖУ¬ËùÒÔ±¾´¦µÄÄѵãÔÚÓÚÀ¹½ØiisµÄÎļþÉÏ´«¹ý³Ì£¬×ª¶ø×Ô¼ºµÄʵÏÖ·½Ê½¡£ËùÒÔ£¬ÎÒÃÇ¿ÉÒÔʵÏÖÒ»¸öIHttpModuleÀ´´¦ÀíÉÏ´«¹ý³Ì¡£¾ßÌåµÄ¹ý³ÌÊÇApplication_BeginReque ......