asp.net¾²Ì¬»¯htmlʱ²»Êä³ö__VIEWSTATE
protected override void Render(HtmlTextWriter writer)
{
StringWriter sw = new StringWriter();
HtmlTextWriter htmlw = new HtmlTextWriter(sw);
//°ÑÒ³ÃæÉú³ÉÄÚÈÝÄóöÀ´
base.Render(htmlw);
htmlw.Flush();
htmlw.Close();
string pageContent = sw.ToString();
string pattern=@"\<input type=""hidden"" name=""__VIEWSTATE""[^\>]*\>";
pageContent = Regex.Replace(pageContent, pattern, string.Empty, RegexOptions.IgnoreCase | RegexOptions.Multiline);
Response.Write(pageContent);
}
Ïà¹ØÎĵµ£º
Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº & ......
Áù¡¢ListItem Àà
ListItem ¿Ø¼þ±íʾ ListBox »ò RadioButtonList ¿Ø¼þµÈÊý¾Ý°ó¶¨Áбí¿Ø¼þÖеĸö±ðÊý¾ÝÏî¡£
Óм¸ÖÖ·½·¨¿ÉÒÔÖ¸¶¨ÎªÁбí¿Ø¼þÖеÄÏîÏÔʾµÄÎı¾¡£×î³£Óõķ½·¨Êǽ«Îı¾·ÅÔÚÄÚ²¿ HTML ÄÚÈÝÖС£ÄÚ²¿ HTML ÄÚÈÝÊÇ ListItem ¿Ø¼þµÄ¿ªÊ¼±ê¼ÇºÍ½áÊø±ê¼ÇÖ®¼äµÄÎı¾¡£»¹¿ÉÒÔʹÓà Tex ......
Îå¡¢ViewCollection Àà
ViewCollection Àà±íʾһ¸ö¼¯ºÏÈÝÆ÷£¬¸ÃÈÝÆ÷ʹ MultiView ¿Ø¼þ¿ÉÒÔά»¤Æä×ӿؼþÁÐ±í¡£MultiView ¿Ø¼þÖ»ÄÜ°üº¬ View ¿Ø¼þ×÷Ϊ×ӿؼþ¡£
ʹÓà Add ·½·¨¿ÉÒÔ½«Ð嵀 View ¿Ø¼þÌí¼Óµ½ ViewCollection ¼¯ºÏÖеÄÐòºÅË÷ÒýÊý×éĩβ¡£Ê¹Óà AddAt ·½·¨¿ÉÒÔ½«Ð¿ؼþÌí¼Óµ½Ìض¨µ ......
ÓÉÓÚÒ³Ãæ¿Ø¼þµÄʼþÒýÆðµÄpostback»Ø·¢£¨±ÈÈçµã»÷ʼþ£©´¦Àí³ÌÐò·¢ÉúÔÚÓû§¿Ø¼þ³õʼ»¯Ê¼þ£¨onload£©Ö®ºó£¬ËùÒÔÒªÏëͨ¹ýµã»÷ʼþ´¦Àíº¯ÊýÀ´´«µÝÖµµ½Óû§¿Ø¼þ£¬±ØÐëÒªÔÚÒ³ÃæµÄonloadÖд«Öµ if(!page.IsPostBack) { Ò³Ãæ³õʼ»¯£º// } else { ´«µÝ²ÎÊýµ½Óû§¿Ø¼þ´¦Àí³ÌÐò£¨£© ......
PlaceHolder ¿Ø¼þʹÄú¿ÉÒÔ½«¿ÕÈÝÆ÷¿Ø¼þ·ÅÖõ½Ò³ÉÏ£¬È»ºóÔÚÔËÐÐʱ¶¯Ì¬µØ½«×ÓÔªËØÌí¼Óµ½¸ÃÈÝÆ÷ÖС£
Ò»¡¢±³¾°
PlaceHolder Web ·þÎñÆ÷¿Ø¼þʹÄú¿ÉÒÔ½«¿ÕÈÝÆ÷¿Ø¼þ·ÅÖõ½Ò³ÄÚ£¬È»ºóÔÚÔËÐÐʱ¶¯Ì¬Ìí¼Ó¡¢É¾³ý»òÒÀ´Îͨ¹ý×ÓÔªËØ¡£¸Ã¿Ø¼þÖ»³ÊÏÖÆä×ÓÔªËØ£»Ëü²»³ÊÏÖ×ÔÉíµÄÈκαê¼Ç¡£
ÀýÈ磬 ......