Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

6ÌõASP.NET±à³ÌʵÓü¼ÇÉ

À´Ô´£ºhttp://www.code-123.com/html/2009917202320580.html
  1.¸ú×ÙÒ³ÃæÖ´ÐÐ
      ÉèÖöϵãÊÇÒ³Ãæµ÷ÊÔ¹ý³ÌÖеij£ÓÃÊֶΣ¬³ý´ËÖ®Í⣬»¹¿ÉÒÔͨ¹ý²é¿´Ò³ÃæµÄ¸ú×ÙÐÅÏ¢½øÐдíÎóÅŲéÒÔ¼°ÐÔÄÜÓÅ»¯¡£ASP.NETÖÐÆôÓÃÒ³Ãæ¸ú×ٷdz£·½±ã£¬Ö»ÐèÔÚPageÖ¸ÁîÖмÓÈëTrace="True"ÊôÐÔ¼´¿É£º
    <%@ Page Language="C#" Trace="true">
      
      ¸ú×ÙÐÅÏ¢¿ÉÒÔ·ÖΪÁ½Àࣺ 
      a.Ò³ÃæÖ´ÐÐÏêϸÇé¿ö
      ÆäÖÐÖ÷Òª°üÀ¨Ò³ÃæÉúÃüÖÜÆÚÖи÷ʼþÁÐ±í¡¢¿Ø¼þÊ÷Áбí(¿ÉÒԲ鿴ÿ¸ö¿Ø¼þµÄHTML×Ö½ÚÊýÒÔ¼°ViewState×Ö½ÚÊý)¡¢Session״̬¡¢Application״̬¡¢Cookie¼¯ºÏ¡¢QueryString¼¯ºÏ¡¢·þÎñÆ÷±äÁ¿µÈÐÅÏ¢¡£
      b.×Ô¶¨Òå¸ú×ÙÐÅÏ¢
      ͨ¹ýÔÚÒ³Ãæ´úÂëÖе÷ÓÃTrace.Write()»òTrace.Warn()·½·¨±ã¿É½«Ö¸¶¨ÄÚÈÝдÈë¸ú×ÙÐÅÏ¢ÖеÄ"Trace Information"½Ú¡£¾ÍËãÒ³Ãæ·¢ÉúÁË´íÎ󣬸ú×ÙÐÅÏ¢»¹ÊÇ»áÏÔʾ³öÀ´£¬²¢ÇÒÔÚ·¢²¼Ó¦ÓóÌÐòʱÎÞÐèɾ³ýÏà¹ØµÄ¸ú×Ù´úÂ룬ֻÐè´ÓPageÖ¸ÁîÖÐÒƳýTraceÊôÐÔ¼´¿É¡£ 
 2.ÔÚ·þÎñÆ÷¶Ë¿Ø¼þÖÐÌí¼Ó¿Í»§¶ËÊôÐÔ
      ÎÒÃÇÓÐʱ»áÏò·þÎñÆ÷¶Ë¿Ø¼þÖÐÌí¼ÓһЩÌØÊâµÄÊôÐÔ£¬ÕâÀàÊôÐÔ²»ÐèÒª·þÎñÆ÷¶ËµÄ´¦Àí£¬Ö»Ðè¼òµ¥µÄ·¢ËÍÖÁ¿Í»§¶Ë¼´¿É£¬ÎÒÃDz»·Á³ÆÆäΪ¿Í»§¶ËÊôÐÔ£¬ÀýÈçHTMLÊôÐÔ»ò×Ô¶¨ÒåÊôÐÔ(¿ÉÄÜÓÃÓÚʵÏÖijÖÖÌض¨µÄJavaScript¹¦ÄÜ)¡£¿ÉÒÔͨ¹ýÒÔϼ¸ÖÖ·½·¨´ïµ½Õâ¸öÄ¿µÄ£º
      a.Ö±½ÓÏò¿Ø¼þÌí¼Ó¿Í»§¶ËÊôÐÔ
      <asp:Button ID="MyButton" Text="ClickMe" onmouseover="this.style.cursor=’pointer’" runat="server" /> 
      ÆäÖеÄonmouseoverÊÇ¿Í»§¶ËÊôÐÔ£¬×¢Ò⣬±àÒëÆ÷ÊÇÔÊÐíÕâÖÖд·¨µÄ£¬µ«»áÏÔʾ¾¯¸æ¡£
      b.µ÷ÓÃÄÚÖ÷½·¨
      ¿ÉÒÔͨ¹ýµ÷ÓÃWebControl.Attributes.Add()·½·¨Îª¿Ø¼þÌí¼Ó¿Í»§¶ËÊôÐÔ£¬ÈçÏÂËùʾ£º
         MyButton.Attributes.Add("onmouseover", "this.style.cursor=’pointer’"); 
      ÕâÒ²


Ïà¹ØÎĵµ£º

ASP.NET³ÌÐòÖг£ÓõÄÈýÊ®ÈýÖÖ´úÂë

 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.Attri ......

ASP.netÒ³ÃæÌøת·½Ê½±È½Ï

1 response.redirect Õâ¸öÌøתҳÃæµÄ·½·¨ÌøתµÄËٶȲ»¿ì£¬ÒòΪËüÒª×ß2¸öÀ´»Ø£¨2´Îpostback£©£¬µ«Ëû¿ÉÒÔÌøתµ½ÈκÎÒ³Ã棬ûÓÐÕ¾µãÒ³ÃæÏÞÖÆ£¨¼´¿ÉÒÔÓÉÑÅ»¢Ìøµ½ÐÂÀË£©£¬Í¬Ê±²»ÄÜÌø¹ýµÇ¼±£»¤¡£µ«ËÙ¶ÈÂýÊÇÆä×î´óȱÏÝ£¡redirectÌøת»úÖÆ£ºÊ×ÏÈÊÇ·¢ËÍÒ»¸ö httpÇëÇ󵽿ͻ§¶Ë£¬Í¨ÖªÐèÒªÌøתµ½ÐÂÒ³Ã棬Ȼºó¿Í»§¶ËÔÚ·¢ËÍÌøתÇëÇóµ½·þÎ ......

asp.netʵÏÖÊ¡ÊÐÇø¼¶ÁªÏÂÀ­ÁÐ±í²¢±£´æ״̬

asp.netʵÏÖÊ¡ÊÐÁª¶¯²¢ÇÒ±£´æ״̬£¬ÊµÏÖÔ­Àí£º³õ´ÎʹÓÃC#´«Í³µÄDataBind½øÐÐÊý¾Ý°ó¶¨£¬Ñ¡ÔñÊ¡£¬Êкó½øÐÐajax·½Ê½¼ÓÔØϼ¶ÁÐ±í£¬²¢½«Ñ¡¶¨Öµ±£´æµ½HiddenÖУ¬µã»÷Ìá½»ºó¸ù¾ÝHiddenµÄÖµ½øÐÐÊ¡£¬Êа󶨣¬ÔÙ½«HiddenµÄÖµ¸³¸øDropDownListµÄSelectedValue£¬´Ó¶øʵÏÖ״̬µÄ±£´æ¡£
HTML´úÂë
<asp:HiddenField ID="HiddenField ......

Asp.netÖÐDataBinder.Eval Ó÷¨

Asp.netÖÐDataBinder.EvalÓ÷¨µÄ×ܽá
<%# Bind("Subject") %> //°ó¶¨×Ö¶Î
<%# Container.DataItemIndex + 1%> //ʵÏÖ×Ô¶¯±àºÅ
<%# DataBinder.Eval(Container.DataItem, "[n]") %>
ͨ³£Ê¹Óõķ½·¨(ÕâÈý¸öÐÔÄÜ×îºÃ)
<%# DataBinder.Eval(Container.DataItem, "ColumnName") %>
<%# DataBi ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ