MainPageÎļþ£ºWebForm1.aspx
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="TestMasterPage.WebForm1" enableViewState="False"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder></form>
</body>
</HTML>
WebForm1.aspx.cs
using System;
using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; us ......
ÔÚC#ÖÐ
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[GenerateScriptType(typeof(Employee ))]
[ScriptService]
public class PeopleManagementService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public Employee CreateNewEmployee()
{
return new Employee();
}
}
vb.net
Imports System;
Imports System.Web;
Imports System.Web.Services;
Imports System.Web.Services.Protocols;
Imports System.Web.Script.Services;
Imports System.Collections.Generic;
Imports System.Collections;
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBindin ......
ÔÚC#ÖÐ
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[GenerateScriptType(typeof(Employee ))]
[ScriptService]
public class PeopleManagementService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public Employee CreateNewEmployee()
{
return new Employee();
}
}
vb.net
Imports System;
Imports System.Web;
Imports System.Web.Services;
Imports System.Web.Services.Protocols;
Imports System.Web.Script.Services;
Imports System.Collections.Generic;
Imports System.Collections;
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBindin ......
1. Web.configÖÐÌí¼Ó:
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
2. 頁ÃæÖÐÌí¼Ó:
<head>
<meta http-equiv="Content-Type" content="charset=utf-8"/>
</head>
3. ×¢ÒâʹÓõÄ樣ʽÖеÄFontÊÇ·ñ會ÏÞÖÆ×ÖµÄ顯ʾ(×îºÃ²»Òª¼Ó×ÖÐÍ) ......
Ê×ÏÈÃèÊöÒ»ÏÂÎÊÌâ:ÒòΪ¿Í»§µÄÐèÒª,°ÑËùÓжÔÓÚÊý¾Ý¿âµÄ²Ù×÷×ö³ÉÁË´æ´¢¹ý³Ì,ͬʱҲ´æÔÚ´øÓÐÊäÈë²ÎÊýµÄ´æ´¢¹ý³Ì.¿Í»§ÒªÇó½«ËùÓеÄÐÅÏ¢¶¼¿ÉÒÔÓÃË®¾§±¨±íÏÔʾ.ÎÒÃǶ¼ÖªµÀ,ҪʹÓÃË®¾§±¨±íÎÒÃǾÍҪʹÓÃÊý¾ÝÔ´µÄ.ÔÚÕâÀï,ÎÒÃÇʹÓõÄÊý¾ÝÔ´×ÔÈ»¶øÈ»Ò²¾ÍÊÇ´æ´¢¹ý³ÌÁË.µ±È»,ÎÒÃÇÒ²ÊÇÖªµÀµÄ,ÔÚADO.NETµÄÁ¬½ÓģʽÏÂ,Òª¸øË®¾§±¨±íÉèÖÃÊý¾ÝÔ´ÎÒÃÇÐèÒªÓõ½Êý¾Ý¼¯Îļþ,ͬʱ,Ò²ÃâÈ¥ÁËÎÒÃÇÉè¼ÆË®¾§±¨±íµÄʱ¼ä.ÔÚʹÓÃÊý¾Ý¼¯Îļþ×÷Ϊˮ¾§±¨±íµÄÊý¾ÝԴʱ´æÔÚÁËÕâÑùÒ»ÖÖÇé¿ö,ÎÒÃÇʹÓÃûÓдøÊäÈë²ÎÊýµÄ´æ´¢¹ý³ÌÊǺܼòµ¥µÄ,¿ÉÊÇÒ»µ©ÎÒÃÇÒªÍù´æ´¢¹ý³ÌÀïÃæ´«Èë²ÎÊý,¾Í³öÏÖÁËÎÊÌâ,ÎÒÃDz»ÄÜÏñÔÚwinformµ±ÖÐÄÇÑù¸øË®¾§±¨±íʵÀý»¯,ÔÒòÊÇÔÚASP.NET 2005ÖÐË®¾§±¨±íÊÇÒ»¸öÎļþ,ËüûÓи½´øµÄ.csÎļþ.ÄÇô,ÎÒÃÇÈçºÎ½â¾öÕâ¸öÎÊÌâÄØ?
½âÎö:²ÎÕÕÒÔǰÔÚwinformÀïÃæÉè¼ÆµÄģʽ,ÎÒÃÇ¿ÉÒÔÏëµ½,ÔÚwinformÖÐË®¾§±¨±í¿ÉÒÔʵÀý»¯,Êý¾Ý¼¯ÎļþÒ²ÊÇ¿ÉÒÔʵÀý»¯µÄ,¿ÉÊÇÔÚÉÏÊöÎÊÌâÖÐÊDz»ÄÜʵÏÖµÄ,Ò²¾Í²»Äܰ´ÕÕwinformÖеÄд·¨È¥Ð´ÕâЩ´úÂëÁË.ÎÒÃÇ¿ÉÒÔ»ØÏëÒ»ÏÂÔÚASP.NETÏÂËùÓõ½µÄ¶«Î÷:aspxÎļþ,aspx.csÎļþ,Ë®¾§±¨±í,±¨±íÔĶÁÆ÷,±¨±íÔ´,Êý¾Ý¼¯Îļþ,´æ´¢¹ý³Ì.¿É¼û,±¨±íÔ´Õ ......
ASP.NET 2009-08-15 13:45 ÔĶÁ459 ÆÀÂÛ3 ×ֺţº ´ó´ó ÖÐÖРСС 1.Asp.NetÖм¸ÖÖÏàËÆµÄ±ê¼Ç·ûºÅ:
< %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº < %= aaa %>
*.csÖÐ: protected string aaa="ÐÕÃû";
< % %>: ÄÚÁª´úÂë¿éÀïÃæ¿ÉÒÔÔÚÒ³ÃæÎļþ*.aspx»ò*.ascxÎļþÀïÃæÇ¶Èëºǫ́´úÂë
Èç:
< %
for(int i=0;i<100;i++)
{
Reaponse.Write(i.ToString());
}
%>
< %@ %>ÊÇÔÚ*.aspxÒ³ÃæÇ°Ì¨´úÂëµ¼ÈëÃüÃû¿Õ¼ä,
Èç:
< %@ Import namespace="System.Data"%>
2.¿Ø¼þ½ÓÊÕÄÄЩÀàÐÍÊý¾Ý?
´ð:½ÓÊÕBindµÄ¿Ø¼þ£¬Ò»°ãÓÐDropDownList,DataList,DataGrid,ListBoxÕâЩ¼¯ºÏÐÔÖʵĿؼþ£¬¶ø±»À¦°ó
µÄÖ÷ÒªÊÇArrayList(Êý×é),Hashtable(¹þÏ¡±í),DataView(Êý¾ÝÊÓͼ),DataReaderÕâËĸö£¬ÒÔºóÎÒÃǾͿÉÒÔ
¶ÔºÅÈë×ù£¬²»»á³öÏÖDataTable±»À¦°óµ ......
asp.net×°ÔØ½ø¶ÈÌõ¼°¹¤×÷Ò³Ãæ¿ò¼ÜÖ÷ÒªÓÉ4¸ö²¿·Ö×é³É,Õâ4¸ö²¿·ÖµÄÃû³Æ¼°ÔÚÕû¸ö¿ò¼ÜÖÐËùÆðµ½µÄ×÷ÓÃÈçÏÂ:
1.Èë¿ÚÁ´½ÓµØÖ·Ò³Ãæ(aspx):±ÈÈç,µÇÂ¼Ò³Ãæ.Ìṩµ½Ä¿±êµØÖ·µÄÒ»¸öÁ´½Ó,²¢Ïò¸ÃÄ¿±ê´«µÝһЩÆô¶¯±ØÐëµÄ»ù±¾Á´½Ó²ÎÊý.
2.Èë¿ÚÁ´½ÓÄ¿±êÒ³Ãæ(aspx):¸ÃÄ¿±ê¶ÔÏóÊÇÕû¸ö¿ò¼ÜµÄºËÐÄ,Ò³Ãæ×°ÔØÊ±Í¨¹ýdocument.writeÊä³ö2¸öiframe,ÆäÖÐÒ»¸öiframe1°üº¬ÔÚÒ»¸ödivÖÐ,¸ÃiframeÖ¸Ïò×°ÔØ½ø¶ÈÐÎÏóÒ³Ãæ.ÁíÒ»¸öiframe2µÄsrcÉèÖÃΪ¿Õ(Óɺǫ́´úÂëÔÚºóÆÚÉèÖÃsrcÖ¸Ïòʵ¼ÊÄ¿±ê¹¤×÷Ò³Ãæ),ÔÚÊä³ö2¸öiframeµÄhtml´úÂëºó,Á¢¼´Êä³öͨ¹ýxmlHttpÇëÇó×ÔÉíµÄrequest,²¢½«request·µ»ØµÄÖµ¸³Óèiframe2µÄsrcÊôÐÔ.
ºǫ́´úÂëÔÚÒ³Ãæ×°ÔØµÄ¹ý³ÌÖÐ,½«´«ÈëµÄ»ù±¾Á´½Ó²ÎÊý·ÅÖõ½cacheÖÐ,±¸ÓÃ.
&nbs ......