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

ÀûÓÃASP.NET¼¼Êõ¶¯Ì¬Éú³ÉHTMLÒ³Ãæ

ÎÄÕ³ö´¦£ºhttp://hi.baidu.com/richiezheng/blog/item/8bb94b8692315b3867096efa.html
ÀûÓÃASP.NET¼¼Êõ¶¯Ì¬Éú³ÉHTMLÒ³Ãæ
˼·
¡¡¡¡1. ÀûÓÃÈçDw-MxÕâÑùµÄ¹¤¾ßÉú³Éhtml¸ñʽµÄÄ£°å£¬ÔÚÐèÒªÌí¼Ó¸ñʽµÄµØ·½¼ÓÈëÌØÊâ±ê¼Ç(Èç$htmlformat$),¶¯Ì¬Éú³ÉÎļþʱÀûÓôúÂë¶ÁÈ¡´ËÄ£°å£¬È»ºó»ñµÃǰ̨ÊäÈëµÄÄÚÈÝ£¬Ìí¼Óµ½´ËÄ£°åµÄ±ê¼ÇλÖÃÖУ¬Éú³ÉÐÂÎļþÃûºóдÈë´ÅÅÌ£¬Ð´ÈëºóÔÙÏòÊý¾Ý¿âÖÐдÈëÏà¹ØÊý¾Ý¡£
¡¡¡¡2. ʹÓúǫ́´úÂëÓ²±àÂëHtmlÎļþ£¬¿ÉÒÔʹÓÃHtmlTextWriterÀàÀ´Ð´htmlÎļþ¡£
¡¡¡¡Óŵã
¡¡¡¡1. ¿ÉÒÔ½¨Á¢·Ç³£¸´ÔÓµÄÒ³Ã棬ÀûÓðüº¬jsÎļþµÄ·½·¨£¬ÔÚjsÎļþÄÚ¼ÓÈëdocument.write()·½·¨¿ÉÒÔÔÚËùÓÐÒ³ÃæÄÚ¼ÓÈëÈçÒ³ÃæÍ·£¬¹ã¸æµÈÄÚÈÝ¡£
¡¡¡¡2. ¾²Ì¬htmlÎļþÀûÓÃMS Windows2000µÄIndex Server¿ÉÒÔ½¨Á¢È«ÎÄËÑË÷ÒýÇ棬ÀûÓÃasp.net¿ÉÒÔÒÔDataTableµÄ·½Ê½µÃµ½ËÑË÷½á¹û¡£¶øWin2000µÄIndex·þÎñÎÞ·¨²éÕÒxmlÎļþµÄÄÚÈÝ¡£Èç¹û°üÀ¨ÁËÊý¾Ý¿âËÑË÷ÓëIndexË÷ÒýË«ÖزéÕÒ£¬ÄÇô´ËËÑË÷¹¦Äܽ«·Ç³£Ç¿´ó¡£
¡¡¡¡3. ½ÚÊ¡·þÎñÆ÷µÄ¸ººÉ£¬ÇëÇóÒ»¸ö¾²Ì¬µÄhtmlÎļþ±ÈÒ»¸öaspxÎļþ·þÎñÆ÷×ÊÔ´½ÚÊ¡Ðí¶à¡£
¡¡¡¡È±µã
¡¡¡¡Ë¼Â·¶þ£º Èç¹ûÓÃÓ²±àÂëµÄ·½Ê½£¬¹¤×÷Á¿·Ç³£´ó£¬ÐèÒª·Ç³£¶àµÄhtml´úÂë¡£µ÷ÊÔÀ§ÄÑ¡£¶øÇÒʹÓÃÓ²±àÂëÉú³ÉµÄhtmlÑùʽÎÞ·¨Ð޸ģ¬Èç¹ûÍøÕ¾¸ü»»Ñùʽ£¬ÄÇô±ØÐëµÃÖØбàÂ룬¸øºóÆÚ´øÀ´¾Þ´óµÄ¹¤×÷Á¿¡£
¡¡¡¡Òò´ËÕâÀï²ÉÓõÄÊǵÚÒ»ÖÖ˼·
¡¡¡¡Ê¾ÁдúÂë
¡¡¡¡1.¶¨Òå(template.htm)htmlÄ£°åÒ³Ãæ
<html>
<head>
<title>www.knowsky.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body >
<table $htmlformat[0] height="100%" border="0" width="100%" cellpadding="10" cellspacing="0" bgcolor="#eeeeee" style="border:1px solid #000000">
<tr>
<td width="100%" valign="middle" align="left">
<span style="color: $htmlformat[1];font-size: $htmlformat[2]">$htmlformat[3]</span>
</td>
</tr>
</table>
</body>
</html>
¡¡¡¡2.asp.net´úÂ룺
//---------------------¶ÁhtmlÄ£°åÒ³Ãæµ½stringbuilder¶ÔÏóÀï----
string[] format=new string[4];//¶¨ÒåºÍhtmlyem±ê¼ÇÊýÄ¿Ò»ÖµÄÊý×é
StringBuilder htmltext=new StringBuilder();
try
{
¡¡using (StreamReader sr = new StreamReader("´


Ïà¹ØÎĵµ£º

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

ASP.NETµÄÎå´óÊý¾Ý¿Ø¼þdz̸

»¶Ó­½øÈë.NETÉçÇøÂÛ̳£¬Óë200Íò¼¼ÊõÈËÔ±»¥¶¯½»Á÷ >>½øÈë
ASP.NET Êý¾Ý¿Ø¼þ:GridView,DataList,Repeater ,DetailsView,FormView¡£
ASP.NET Êý¾Ý¿Ø¼þ×ÛÊö£º
1.Ç°3¸öÓÃÓÚ³ÊÏÖ¶àÌõ¼Ç¼,ºóÃæ2¸öÓÃÓÚ³ÊÏÖµ¥ÌõÊý¾ÝÃ÷ϸ,¼´³£ÓõļǼÃ÷ϸ¡£
2.GridViewºÍDetailsView¿Ø¼þµÄ²¼¾Ö¹Ì¶¨,×Ô¶¨ÒåÊý¾ÝÏÔʾµÄ²¼¾Ö¹¦ÄÜÓÐÏÞ,Ò»°ã ......

»¶Ó­Äúѧϰ asp.net 2.0

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
< ......

asp.netµÄÔÚÏßÈËÊýͳ¼Æ

Ò»°ãÊÇ·ÅÔÚGlobal.asaxÖУ¬´úÂëÈçÏ£º
<%@ Application Language="C#" %>
<mce:script runat="server"><!--
void Application_Start(object sender, EventArgs e)
{
// ÔÚÓ¦ÓóÌÐòÆô¶¯Ê±ÔËÐеĴúÂë
//Application["online"] = 10;//ÉèÖÃĬÈÏÔÚÏßÈËÊý,ÔÚÐéÄâ¿Õ¼äÉÏ£¬ÕâÀï²»»á ......

¹ØÓÚASP.NET¿Ø¼þÔÚ±àÒëʱÕÒ²»µ½µÄ½â¾ö·½°¸

     ±¾ÈË¿ª·¢ASP.NETÒÑÓÐÁ½Äê¶àÁË¡£Ì¸ÆðASP.NETÕæÊÇÈÃÎÒ»¶Ï²ÈÃÎÒÓÇ¡£×òÌìÓÖ³öÏÖÁËÄǸöÆæ¹ÖµÄÎÊÌ⣬¾ÍÊÇÔÚÒ³ÃæÍêȫдºÃºó£¬ÖØÐÂÉú³Éʱ±¨:XXX(Ò³ÃæÃû)²»°üº¬(XXX)µÄ¶¨Òå¡£ÔÚCSÎļþÏÂÊÇ¿ÉÒÔÓà this.xxx д³öÀ´µÄ£¬Ò³ÃæÉÏҲûÎÊÌâ¡£ÔÚ½â¾ö·½°¸ÖÐÖØÐÂÉú³ÉÒ³ÓÖ¿ÉÒÔ£¬ÖØÐÂÉú³ÉÍøÕ¾¾Í»á±¨Õâ¸ö´íÎó¡£½«this.XXX ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ