Asp.NetÖж¯Ì¬¼ÓÔؿؼþ
ÎÒÃÇÔÚAsp.Net¿ª·¢¹ý³ÌÖУ¬ÓÐʱºòΪÁË¿ª·¢µÄÐèÒª£¬»ò´ïµ½Ò»¶¨µÄЧ¹û£¬ÎÒÃÇ»á²ÅÈ¡¶¯Ì¬¼ÓÔØÓû§¿Ø¼þµÄ·½·¨À´ÊµÏÖ£¬¶¯Ì¬¼ÓÔØÓû§¿Ø¼þ£¬¿ÉÒÔÔÚͬһ¸öÒ³ÃæÀïÃ棬¸ù¾Ý²»Í¬µÄÇé¿öÏÔʾ²»Í¬µÄÄÚÈÝ£¬Ê¹ÎÒÃÇÔÚ¿ª·¢Ê¡Ê±Ê¡Á¦¡£
¡¡ÄÇôÎÒÃÇÔõôʵÏÖ¶¯Ì¬¼ÓÔØÓû§¿Ø¼þÄØ£¬ÆäʱºÜ¼òµ¥£¬ÎÒÃÇÖ»ÒªÔÚÒ³ÃæÀïÒª·Å¿ØµÄ¼þµÄµØ·½·ÅÒ»¸öռλ¿Ø¼þ <asp:PlaceHolder ID="phContent" runat="server"></asp:PlaceHolder> £¬Õâ¸ö¿Ø¼þÊÇAsp.Net×Ô´øµÄ£¬È»ºóÔÚ³ÌÐòÓþͿÉÒԺܼòµ¥µØʵÏÖÁË£¬³ÌÐòÈçÏ£º
Control Ctr = Page.LoadControl("UserControl/Control.ascx"); //¼ÓÔؿؼþ
Ctr.ID = "ControlName"; //ÉêÃ÷¿Ø¼þÃû
phContent.EnableViewState = false; //Ö¸¶¨ÊÇ·ñÆôÓÃViewState
phContent.Controls.Add(Ctr); //Êä³ö¿Ø¼þ
µ±È»£¬²»Ò»¶¨Ö»ÓÐÓû§¿Ø¼þ¿ÉÒÔÕâÑùʵÏÖ£¬ÆäËüµÄ¿Ø¼þÒ²¶¼¿ÉÒÔÀàËƵØʵÏÖ¡£
ÔÚASP.NETÖж¯Ì¬¼ÓÔØÄÚÈÝ£¨Óû§¿Ø¼þºÍÄ£°å£©
Òªµã£º
1£® ʹÓÃPage.ParseControl
2£® ʹÓÃbase.LoadControl
µÚÒ»²¿·Ö£º¼ÓÔØÄ£°å
ÏÂÃæÊÇÒ»¸öÄ£°å“<table width=100%><tr><td width=100% colspan=2 runat=server id=ContainerTop></td></tr><tr><td width=30% runat=server id=ContainerLeft></td><td width=70% runat=server id=ContainerRight></td></tr></table>”ÈçºÎ°ÑËüÌí¼Óµ½Ò³ÃæÖÐÄÇ¡£¡¡
Ê×ÏÈ£¬ÄãÒªÓÐÒ»¸öÒ³Ã棨.aspx£©£¬ÔÚÒ³ÃæÖÐÓÐÒ»¸öÒ»ÐÐÒ»Áеıí¸ñ£¬²¢ÇÒÊÇ·þÎñÆ÷¶ËµÄTDÎÒÃǾͰÑËüÃüÃûΪTemplateContainer¡£ºÃÁËÏÖÔÚµ½´úÂë±à¼´°¿Ú£¬ÔÚpage_loadÖмÓÔØÄ£°å¡£
µÚ¶þ²½£¬Ê¹ÓÃPage.ParseControl½«ÉϱߵÄHTML´úÂë·ÖÎöΪweb´°ÌåÒ³»òÓû§¿Ø¼þµÄSystem.web.ui.controlÈçÏ´úÂ룺
protected System.Web.UI.HtmlControls.HtmlTableCell TemplateContainer;
System.Web.UI.Control objContainer;
private void Page_Load(object sender, System.EventArgs e)
{
objContainer =Page.ParseControl(“ÉϱߵÄHTML´úÂë);
this.TempContainer.Controls.Add(objContainer);
}
Ä£°åÒѾ¼ÓÔØÍê±Ï¡£
µÚ¶þ²¿·Ö£º¼ÓÔØÓû§¿Ø¼þ
Ê×ÏÈ£¬ÄãҪȷ¶¨Óû§¿Ø¼þÒª¼ÓÔص
Ïà¹ØÎĵµ£º
<a>±êÇ©
1. <a href=”test.aspx”></a>
2. ÕâÊÇ×î³£¼ûµÄÒ»ÖÖתÏò·½·¨;
HyperLink¿Ø¼þ
1. Asp.net ·þÎñÆ÷¶Ë¿Ø¼þ ÊôÐÔNavigateUrlÖ¸¶ ......
ÍøÂç´òÓ¡¸ÅÊö
• B/S½á¹¹µ¼ÖÂÁËWebÓ¦ÓóÌÐòÖдòÓ¡µÄÌØÊâÐÔ¡£
• ³ÌÐòÔËÐÐÔÚä¯ÀÀÆ÷ÖУ¬´òÓ¡»úÔÚ±¾µØ£¬¶øÎļþÈ·¿ÉÄÜÔÚ·þÎñÆ÷ÉÏ£¬µ¼ÖÂÁË´òÓ¡¿ØÖÆ
²»ÊǺÜÁé»î¡£
• ¸ñʽÈçºÎ¿ØÖƺͶ¨ÖƵȣ¬ÊÇÎÒÃÇ¿ª·¢ÖпÉÄÜ»áÃæ¶ÔµÄÎÊÌâ¡£
´òÓ¡ÎĵµµÄÉú³É
• 1¡¢¿Í»§¶Ë½Å±¾·½Ê½
Ò»°ãÇé¿öÏ£¬Ö÷ҪʹÓÃJS ¿ÉÒÔ·ÖÎöÔ´Ò³ÃæµÄ ......
ASP.NET 2.0 ÖÐÐÂÔö¼ÓÁË Theme µÄ¹¦ÄÜ£¬ËüµÄ³öÏÖÄÜÈÃÍøվʵÏÖ»»·ô¸ü¼ÓÈÝÒס£
Theme µÄʵÏÖ°üÀ¨£ºCSS¡¢Skin¡¢MasterPage¡£
CSS ÊÇÓÃÓÚ¿ØÖÆËùÓÐ HTML ±ê¼ÇµÄÍâ¹Û¡£
Skin ÊÇÓÃÓÚ¿ØÖÆËùÓÐ ASP.NET ·þÎñÆ÷µ÷ÕûµÄÍâ¹Û£¬²¢ÇÒ¿ÉÒÔͨ¹ýÊôÐÔ cssClass ¶¨ÒåËüµÄ CSS Ñùʽ¡£
MasterPage ÊÇ *.aspx Ò³ÃæÄ£°æ£¬²»¹ýËüûÓỶ¨Òåµ½ The ......
ÍêÕû´úÂëÈçÏ£º02_ClientCentric.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="02_ClientCentric.aspx.cs" Inherits="ClientCentric" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="h ......
ÔÚASP.NET 2.0ÖУ¬ÓÐʱºòÐèÒª¶ÔASP.NETÉú³ÉµÄHTML´úÂë½øÐд¦Àí£¬»òÕßÊDZ£´æ³É¾²Ì¬Îļþ¡£ASP.NET Ìá
¹©ÁËÖ±½Ó½«ÇëÇó±£´æ³ÉÎļþµÄ·½·¨£ºHttpRequest.SaveAs·½·¨¡£ÏÂÃæÕâ¸ö·½·¨¾ÍÊÇÔÚASP.NET 2.0Öеõ½
ASP.NETÉú³ÉµÄHTML´úÂ룬ͬʱ£¬Éú³ÉÒ»¸ö¾²Ì¬ÎļþµÄ·½·¨¡£
C#
<%@ Page Language="C#" AutoEventWireup="true" %&g ......