Title: ??.net???????????????
1??6 ??????
- ??????
- ????????????
- ??.net???????????????
???????6??,????6???
2?? 20 ?? 2 ?? ??? ??
?? ??1 ?????? ??1 ?????? ??1 ?????? ??1 ?????? ??1 ?????? ??1 ?????? ??1 ??????
?? ??ASP????????? ??ASP????????? ??ASP????????? ??ASP????????? ??ASP????????? ??ASP????????? ??ASP?????????
?? ASP????????? ASP????????? ASP????????? ASP????????? ASP????????? ASP????????? ASP?????????
?? ? ? ? ? ? ? ?
??1 ?????? ?????? ????????????????????,??
??????????????????,????????????????,?????????????,
????????????????????,?????????????????????????????
?????
3 ?????? (?)???????? ????,????????????,?
???????????? ? ?????????????????????????????,??
??????????,??Web???????? ? ?????????????,???????
??? ? ?????????????????????????????
(?)?????????? ?????????CGI?JSP?ASP /
ASP.NET?PHP?,??????? 1.CGI
???,??????????CGI??,?Common Gateway
Interface(??????)????????????CGI??,?VB?Delphi?C/C
????????CGI????Web??????,?????????Web????????????
?????CGI????Web??????????????,????????????????????
?????????????????????????,?????????????CGI????????
??,???????????
4- 2.ASP
- ASP?????????????ASP???????????,??????Web????????
?????,???????????ASP?????????,???????????????????C
OM??,???????????????????,???????COM???????????ASP?
???????VBScript,???????COM??,???????ASP????ASP????
??? - ?????ASP??????VBScript,??????,??????
- ????????????????IIS,ASP???????
- ????????????????????????????????Dreamweaver?ASP
Studio,??????????ASP??? - ????????????,ASP??????????
5- ASP??????
- Windows?????????????????ASP??????????????????????
??NT????????? - ASP?????COM?????????,????Windows
NT???????????????????????????????????????,????????
????????????????????? - ASP???????,?????????,????????????
- ??????????????????????????????????ASP??????????
Windows???ASP,ASP????????????????????????? - ????????????????????????????
6- 3.PHP
- PHP(Hypertext Preprocessor)???HTML??????(???IIS?
?ASP)??PHP????????C?Java?Perl??PHP????,????CGI??Pe
rl??????????? - PHP?????????,?MS SQL Server?MySql?Sybase?Oracl
e?,??HTML???????????? - PHP???????????,???????,????,????,???????????PH
P????? - ???????????????????????????????????????,??Interne
t????????????? - ?Apache???????????PHP?Apache??????????????,??????
?????????????(Windows????)??????????????????CPU???
??,??????????Apache?????????? - ?????????PHP??????????????????????????,????Apache
????????????????????????????,PHP???????????
7- PHP?????
- ?????????????PHP????????????????,
- ????????????????????,??PHP?????????,??????????????
?????? - ???????PHP??????????????PHP?????,??????????,?????
gd?,LDAP??LDAP?,,?????????????,????PHP??? - ????????????????,????????????PHP?????????????????
??,????????????? - ???????????????PHP????????????,?????????????????,
???????????,??????????????????,????????
8- 4.JSP
- JSP???HTML????????Java???????????????????????J
ava??????,??????HTML?????????????Java Servlet
?JSP?????,?????Web?????????Java
Servlet?JSP??????? - JSP???Java??????????????????????????Internet??
????JSP????????? - ????????????????????????????????
- ???????????????Jar???????Servlet/JSP,?????????????
??????Application????????????,Java??????????? - ????????????????Java???????????????(?MyEclips),???
??????????????? - JSP??????
- ?ASP??,Java???????????????????????????,??????????
???? - Java???????class????????,?????????????????????????
??????.java???.class??,??????????
9 (?)Visual Studio.NET?? Visual
Studio.NET(??VS.NET)??????????????????,???????????
,????????????,?????.NET??,?????.NET?????,????.NET?
?????????????????.NET 1.???????
???C,??C,??VB??,???????.NET????IL?
2.??????????? ?????????????,??IL??????,???????
?????.NET?????? 3.??????????
Windows???????????,??.NET???????????JIT?????????IL
?????????????????
10 ????????VS.NET?????? 1..NET??
??(Framework)???????,???,?????????????????????????
????????????? ??VB????,???????????????,???????
???????????API??????????Win32????,???VB?????,?????
???VB?????COM??? ??,????Win32
API?ADO(?????????COM??)?????VB?????,??????????????
????????? ????????????????????,???????????????
?????,??????????API????,????????????????????
11 2. ???.NET Framework .NET
Framework?????Microsoft .NET???????????,??????????
?(Runtime)???? ?????????,???????????,??VB
6.0?????????.NET???????????????????????????
??.NET Framework,??VB .NET????????????VB
6.0??????,??????????,??????????XML????????API,????
??????.NET Framework?????? 3..NET
Framework?Visual Basic .NET
????VB????,??.NET Framework??????????,????????????
??????????.NET???????,?????VB .NET??????????VB
6.0????????
12 4.??????? ???????????????,????????????????
??????????????(???????)?????,?????????????????????
?????????????,?????????????????????????????????,??
???????????????,?????????????? .NET
Framework??????????,????????????,??????????????
5.??????? .NET Framework???????????????????
?????,? ?VB????????.NET Framework????????System.Th
reading?????????????,?????.NET???????????????????
13 (?)ASP?????? 1. ASP?? ASP?Active
Server Page???,??ASP?????????????Web????????,?????
????Web????,????????? 2.ASP?????
????Web???,?????ASP????,???ASP???ASP????.asp??????
??????????????.asp???,Web?????ASP????,????????????
??????,???????????????? ??,?Web???????????????
?????,???????????????? 3.ASP??
ASP????HTML???????????????Web????????????????,????
?????????ASP????????? ????????VBScript?JavaScr
ipt,??????????????,????????????????????,?Web??????
??HTML??,???????????
14 ?ASP???,???????????lt?gt???,??ltscriptgt????
runatserver????????????????? ltscript
languageVBScript runatservergt????lt/scriptgt
???????????,??????ltscriptgt?lt/scriptgt???????lts
cript languageVBScriptgt????lt/scriptgt ?6.1
ASP?????????????? lt_at_languageVBScriptgt lthtmlgtlthe
adgt lttitlegtVBScript??lt/titlegt lt/headgt ltbodygt ltScri
pt Language"VBScript"gt Dim ctime
ctimenow() document.write ctime"???????" lt/scr
iptgt ltbrgtlt(now())gt?????? lt/bodygtlt/htmlgt
15 4.ASP????? ????include?????????????ASP???
????? include virtual file ???
(1) ??virtual???(????) ??include virtual
/Myapp/??? (2) ??file???(????)
??include file Myapp/???
????????????????Myapp????,?????????
??,????????????????,??????.inc????ASP????????????,
???????????????,???????????A??B,?B?????A,??,??????
????
16 (?)ASP????? ???????????,???????????????ASP?
???????????,???????????????????????????????????
ASP????????Request?Response?Application?Session?
Server?Error? ??????????????Request??????????
???????Response??????????????Application????????
??????Session????? 1. ????
ASP????????Active X???Active X???????????? Active
X??????????????,?????????????,??????????????????
???????????(.dll)??????(.exe)???????,??????????
???????????????????????,??????????????????
??Server.CreateObject???????????,?? Set
dbServer.CreateObject(ADODB.Connection)
???????????????db?
17 2. Request?? ??Request????????HTTP????????
??,valueRequest.Form(Name),???HTML??????POST?????
??Name???????,???????????,?????????Request???Query
String?Form?Cookies?ClientCertificate?ServerVariab
les ?5??????? HTML???????????????????Request??
,????????POST???GET???GET????????????QueryString?
??,POST????????????Form???? (1) Form??
?6.2 Request???Form???????(ex6-2.asp) lthtmlgtlthead
gtlttitlegtRequest???Form??????lt/titlegtlt/headgt ltbodygt
???????ltPgt ltform method"POST" action""gt ltinput
type"text" name"hobby" size"20"gtltbrgt ltinput
type"checkbox" name"hobby" value"??"gt?? ltinput
type"checkbox" name"hobby" value"???"gt???ltPgt lti
nput type"submit" name"B1" value"??"gt ltinput
type"reset" name"B2" value"??"gtltPgt lt/formgt
18lt ????? Response.Write "ltbrgt????hobby?????????
ltbrgt" Response.Write Request.Form("hobby")"ltbrgt
" ????? Response.Write "ltbrgt?for
Eachnext??????ltbrgt" For Each i In
Request.Form("hobby") Response.Write
i"ltbrgt" next ????? Response.Write "ltbrgt?for
next??????ltbrgt" For i1 to Request.Form("hobby
").Count Response.Write Request.Form("hobby")(
i)"ltbrgt" next gt lt/bodygtlt/htmlgt
???????????,??? ????,????????
19?6.3 ??6.2???????,???????????? lthtmlgtltheadgtlttitl
egtRequest???Form??????lt/titlegtlt/headgt ltbodygt??????
?ltPgt ltform method"POST" action""gt ltinput
type"text" name"text1" size"20"gtltbrgt ltinput
type"checkbox" name"hobby1" value"??"gt?? ltinput
type"checkbox" name"hobby2" value"???"gt???ltPgt
ltinput type"submit" name"B1" value"??"gt ltinput
type"reset" name"B2" value"??"gtltPgtlt/formgt lt di
m istr istrRequest.Form("text1") if
Request.Form("hobby1")ltgt"0" then istristr
Request.Form("hobby1") end if if
Request.Form("hobby2")ltgt"0" then istristr
Request.Form("hobby2") end if Response.Write
"????????" istr gt lt/bodygtlt/htmlgt
??????aaa,??????,??????????
20 (2) Response???QueryString???
??POST???,??????GET??????(??)????(???name?pwd?sex?
???????????) a) ??????????????,?????????,??
http//www.ebook.com/log.asp?nameljmpwdnihao
sexFemale b) ?????????,?? ltA
hrefwww.ebook.com/log.asp?nameljmpwdnihaosex
Femalegtlt/Agt c) ?????????,?? ltform
mthod"GET" action"log.asp"gt ltinput
type"text" name"name"gt ltinput
type"password" name"pwd"gt ltselect
name"sex"gt ltoptiongtMalelt/optiongt
ltoptiongtFemalelt/optiongt lt/selectgt
lt/formgt ????a)?b)?c)???ljm?nihao,
?Female????,??????????? http//www.ebook.com/log.
asp?nameljmpwdnihaosexFemale
21 ?GET?????????Request???QueryString????????
lt dim n,p,s nRequest.QueryString("name")
pRequest.QueryString("pwd")
sRequest.QueryString("sex") Response.Write
"????????" n p s gt
GET????????????????????????? (3) Cookie??
Cookie???Request?Response???????,????????????????
??,?????????????????
22 Cookie?????,??????????????,?Win2000/XP?????C
\Document and Settings\???\Cookie?????????????,?
????????????Cookie??,??Web??????????
????????Cookie,?IE????,????????\?Internet???\?????
?\??????,??????Cookie??????
23?6.4 Cookie??????(ex7_21.asp)? lt
Response.Cookies("nike").Expires"2008-10-20"
'??Cookie????? Response.Cookies("nike")Request
.Form("name") '??????Cookie? Response.Write
"?? "Request.Cookies("nike")" ??????!" gt
lthtmlgtltheadgtlttitlegtCookie??????lt/titlegtlt/headgt
ltbodygt ltform method"POST" action"ex7_21.asp"gt
ltPgtltinput type"text" name"name" size"20"gt
ltinput type"submit" value"??" name"B1"gt
ltinput type"reset" value"??" name"B2"gt
lt/formgt lt/bodygtlt/htmlgt
????????????,????,???????
24 3. Response?? Request?????????????????,???
??????????????????????????????????URL???????Cookie
???? ??Response.Cookies(cookie??)????Cookie
??,????Cookie???,???????,?????????
??Response?Expires?????????????????????,?
Response.Expiresn(??),?????????????????? Response
???????????Write?Redirect? (1)
Write????????,????????HTML?????,??
Response.Write("ltscriptgtalert('????!')lt/scriptgt")
Response.Write("????????!") (2)
Response?Redirect??????????URL??,??
Response.Redirect("lx.asp")
25 4. Session?? ??Web???,??Session???????????
???????Web????????????,???Session??????????,??????
????????,????Session ????????????,??????????,???in
dex.asp?? Session("???") "XXX"
XXX??????????? Response.Redirect("index.asp")
??? index.asp ??,???Session("???")??
??index.asp????????????? If Session("???")
"?????" Then else
Response.Redirect("qxerr.asp") ???????????
End If
26 ??Session??????? (1) Session???TimeOut???
???????Session???????(??),???20????lt
Session.TimeOut5 gt (2) Session???Abandon????
???????Session???????????????? lt
Session.Abandon gt ????????????Session??????
(3) Session?Cookie????Session??????????Cookie??
??????(????),??Session????????Session?????????????
?????,?Cookie??????? (?)Visual Basic
.NET????(?)
27?????? ????????????????????? ??????Windows
XP?Dreamweaver?????IIS?Access2003? ?????? ??1
??????????????counter.mdb?Access???,???xxx,??????
?counter??,???????count??????,????????,???1
??2 ?????????????????????,?????aa,???? ltiframe
name"aa" allowTransparency"true" width"178"
height"36" scrolling"no" frameborder"0"gt
lt/iframegt ??3 ????ltheadgt????????? ltscript
language"JavaScript"gt function NewWindow1()
var myopen("count.asp","aa","toolbarno,menubarn
o") lt/scriptgt ??4 ????ltbodygt????????? onLoa
d"NewWindow1()" ??5 ????????????count.asp,??
??
28lt If Not IsPostBack Then dbServer.MapPath("cou
nter.mdb") Set connObjServer.CreateObject("ADOD
B.Connection") connObj.Open "DBQ"db"DefaultD
irDRIVERMicrosoft Access Driver
(.mdb)UIDPWDxxx" set rsObjServer.CreateO
bject("ADODB.Recordset") rsObj.Open "select
from counter",connObj,1,3 rsObj("count")rsObj("
count")1 response.write "?????
"trim(rsObj("count"))" ???!" rsObj.Update
rsObj.Close set rsObjnothing connObj.Close
set connObjnothing end if gt ???????????asp??,??
?2?3?4???,?????5???????????????????
29?? 21 ?? 2 ?? ??? ??
?? ??2 Web??????? ??2 Web??????? ??2 Web??????? ??2 Web??????? ??2 Web??????? ??2 Web??????? ??2 Web???????
?? ????VB.NET???????????? ????VB.NET???????????? ????VB.NET???????????? ????VB.NET???????????? ????VB.NET???????????? ????VB.NET???????????? ????VB.NET????????????
?? VB.NET??????? VB.NET??????? VB.NET??????? VB.NET??????? VB.NET??????? VB.NET??????? VB.NET???????
?? ? ? ? ? ? ? ?
??2 Web??????? ?????? ??VB
.NET?????????????????????,???? Access????
?????? (?)Access???????
(?)VB.NET??Access????????
30 ?????? ???????????????????(???)???????
??????Windows XP?VS.NET?IIS?SQL Server?
?????? (?)??????,?d\abc,??IIS??????????
(?)???????,?????????????,????????,???????
1???Access,?????yhgl.mdb,???????,????xxx?????????,
???? (1) ???(user1)
???(char,10),??(char,8),??(char,1),id(????)
(2) ???(qx) ??(char,1),id(????)
2?????????????
31 (?)????????(yhgl.aspx) ???(???????)???user
1??????????????(??????????)??????
1???vs.net,??Visual Basic??,???ASP.NET
Web????,???http//localhost,?IIS???d\abc,????????
??????????bin??????????,????????WebForm1.aspx?Web?
???,????"???????????????????????????yhgl.aspx
????????????????? 2? ????????
?????Web.config?ltconfigurationgt?????????
ltappSettingsgt ltadd key"data"
value"ProviderMicrosoft.Jet.OLEDB.4.0Data
Source"/gt ltadd key"data1"
value"yhgl.mdb"/gt ltadd key"data2"
value"jet oledbdatabase passwordxxx"/gt
lt/appSettingsgt ????????????????????key??
????????????????????data?data1?data2??????????????
???
32 3????????????? ????????????????????????
?????(DataSet)??,??????ds1?ds2?
??????????????,???????????? 4???????
(1) ????????????1?DataGrid??(DataSource????ds1,D
ataMember????user1, DataKeyField??????) (2)
??4?Label??(Text??????????????????) (3)
??2?TextBox?? (4) ??1?DropDownList??(DataSourc
e????ds2,DataMember????qx, DataValueField?????)
(5) ??1?Button??(Text????????)? (6)
??DataGrid??,???????,??????????????????,?Dat
aGrid????3????(????????????????)?2????(??\??\???
??,PushButton??)? ???????????????????????
33 ???1????(???)?????,HTML???? ltaspTemplateColu
mn HeaderText"???"gt ltItemStyle
Width"120px"gtlt/ItemStylegt ltItemTemplategt ltasplab
el id"Label7" runat"server" text'lt
DataBinder.Eval(Container,"DataItem.???")
gt'gt lt/asplabelgt lt/ItemTemplategt lt/aspTemplateCo
lumngt ??????????HTML???????
?2????(??)?????,???????,HTML???? ltaspTemplateCol
umn HeaderText"??"gt ltItemStyle
Width"280px"gtlt/ItemStylegt ltItemTemplategt ltasplab
el id"Label5" runat"server" text'lt
DataBinder.Eval(Container,"DataItem.??")
gt'gt lt/asplabelgt lt/ItemTemplategt ltEditItemTemplat
egt ltaspTextBox id"Textbox3" runat"server"
Width"276" Text'lt DataBinder.Eval(Container,"D
ataItem.??") gt'gt lt/aspTextBoxgt lt/EditItemTemplat
egt lt/aspTemplateColumngt ??????????HTML???????
34 ?3????(??)?????,?????????,HTML???? ltaspTempl
ateColumn HeaderText"??"gt ltItemStyle
Width"120px"gtlt/ItemStylegt ltItemTemplategt ltasplab
el id"xb0" runat"server" text'lt
DataBinder.Eval(Container,"DataItem.??")
gt'gt lt/asplabelgt lt/ItemTemplategt ltEditItemTemplat
egt ltaspDropDownList id"xb1" runat"server"
width"112" DataSource "lt ds2 gt"
DataMember"qx" DataTextField"??"
DataValueField"??"gt lt/aspDropDownListgt lt/EditIte
mTemplategt lt/aspTemplateColumngt
??????????HTML???????
35 5??????? (1) ???????,?????????????????????
Imports System.Data.OleDb (2)
????????????????? ?????(Page_Load)??????????
Dim connstr As String System.Configuration.C
onfigurationSettings.AppSettings("data") '????
Dim connstr1 As String System.Configuration.C
onfigurationSettings.AppSettings("data1")
Dim connstr2 As String System.Configuration.Conf
igurationSettings.AppSettings("data2") Dim
connstr3 As String connstr System.Web.HttpCont
ext.Current.Server.MapPath(connstr1) connstr2
Dim connection As New OleDbConnection(connstr3)
'????
36 (3) ?????(Page_Load)??????? If Not
IsPostBack Then Dim adp1 As New
Data.OleDb.OleDbDataAdapter("select from
user1", connection) '??????? Dim adp2 As
New Data.OleDb.OleDbDataAdapter("select from
qx", connection) '???????
connection.Open() '??????
adp1.Fill(ds1, "user1") '???????????????ds1?
DataGrid1.DataBind() '????
adp2.Fill(ds2, "qx") '???????????????ds2?
DropDownList1.DataBind() Label1.Text
"???" ds1.Tables("user1").Rows.Count End If
37 (4) ?????? ?1???????????(DataGrid???????
) Sub Grid_Change(ByVal sender As Object, ByVal e
As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex e.NewPageIndex
DataGrid1.EditItemIndex -1 '?????? Dim adp
As New Data.OleDb.OleDbDataAdapter("select from
user1", connection) connection.Open()
'?????? adp.Fill(ds1, "user1")
'?????????????ds1? DataGrid1.DataBind() End
Sub ?2??HTML???ltasp DataGridgt?????(????)??
OnPageIndexChanged"grid_change"
,????????????grid_change??
38 (5) ???????????????? DataGrid1.EditItemInde
x -1 '?????? Dim x, y, z As String x
TextBox2.Text y DropDownList1.SelectedValue.Tri
m If TextBox1.Text "" Then
Response.Write("ltscript language'javascript'gtaler
t('???????!')lt/scriptgt") Dim adp As New
Data.OleDb.OleDbDataAdapter("select from
user1", connection) '???????
connection.Open() '?????? adp.Fill(ds1,
"user1") '?????????????ds1? TextBox2.Text
x DropDownList1.Items.FindByText(y).Selected
True Label1.Text "???"
ds1.Tables("user1").Rows.Count Else
39Dim sqlstr As String "insert into user1 values
('" TextBox1.Text "','" TextBox2.Text
"','" DropDownList1.SelectedValue "',1)"
Dim cmd As New Data.OleDb.OleDbCommand(sqlstr,
connection) Dim adp As New Data.OleDb.OleDbDat
aAdapter("select from user1", connection)
'??????? Dim adp1 As New Data.OleDb.OleDbDataA
dapter("select from user1 where ???'"
TextBox1.Text "'", connection) '???????
connection.Open() '?????? adp1.Fill(ds1,
"user1") '??user1???????????ds1? If
ds1.Tables("user1").Rows.Count 0 Then
'???????? cmd.ExecuteNonQuery()
'??insert into??,???? adp.Fill(ds1,
"user1") '??user1???????????ds1?
DataGrid1.DataBind() Label1.Text "???"
ds1.Tables("user1").Rows.Count
TextBox2.Text "" Else
Response.Write("ltscript language'javascript'gtaler
t('????????,?????!')lt/scriptgt") End If
TextBox1.Text "" End If
40 (6) ?????????????? Sub Grid_ItemCommand(ByVal
source As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs
) If e.CommandName "Edit" Then
DataGrid1.EditItemIndex e.Item.ItemIndex
Dim adp1 As New Data.OleDb.OleDbDataAdapter("selec
t from user1", connection) '??????? Dim
adp2 As New Data.OleDb.OleDbDataAdapter("select
from qx", connection) '???????
connection.Open() '?????? adp1.Fill(ds1,
"user1") '?????????????ds1? adp2.Fill(ds2,
"qx") '?????????????ds2? DataGrid1.DataBind(
) End If If e.CommandName "Cancel" Then
DataGrid1.EditItemIndex -1 '?????? Dim
adp As New Data.OleDb.OleDbDataAdapter("select
from user1", connection)
connection.Open() adp.Fill(ds1, "user1")
???????????????ds1? DataGrid1.DataBind()
End If
41If e.CommandName "Delete" Then
DataGrid1.EditItemIndex -1 '?????? Dim adp
As New Data.OleDb.OleDbDataAdapter("select from
user1", connection) Dim cmd As New
Data.OleDb.OleDbCommand("delete from user1 where
???'" DataGrid1.DataKeys(e.Item.ItemIndex)
"'", connection) ?????? connection.Open()
cmd.ExecuteNonQuery() '??????
adp.Fill(ds1, "user1") If Int(ds1.Tables("user1
").Rows.Count / 10) ds1.Tables("user1").Rows.Cou
nt / 10 Then If DataGrid1.CurrentPageIndex
gt 0 Then DataGrid1.CurrentPageIndex
DataGrid1.CurrentPageIndex - 1 End If
End If DataGrid1.DataBind() Label1.Text
"???" ds1.Tables("user1").Rows.Count End If
42If e.CommandName "Update" Then Dim xm As
TextBox Dim xxb As DropDownList Dim
xxb2 As String Dim adp As New
Data.OleDb.OleDbDataAdapter("select from
user1", connection) connection.Open()
adp.Fill(ds1, "user1") xm
e.Item.FindControl("TextBox3") xxb
e.Item.FindControl("xb1") xxb2
xxb.SelectedValue Dim sqlstr As String
"update user1 set ??'" xm.Text.Trim "',??'"
xxb2 "' where ???'" DataGrid1.DataKeys
(e.Item.ItemIndex) "'" Dim cmd As New
Data.OleDb.OleDbCommand(sqlstr, connection)
Try cmd.ExecuteNonQuery() '??????
Catch ex As Exception
Console.WriteLine("????" ex.Message)
End Try connection.Close()
Response.Redirect("yhgl.aspx") End If end sub
43 (7) ?HTML??ltasp DataGridgt?????(????)??
OnItemCommand "Grid_ItemCommand" ,
???????????????Grid_ItemCommand??? (8)
??????,????????????????????DataGrid??5?(????1)
? Sub DataGrid1_ItemDataBound(ByVal sender As
Object, ByVal e As System.Web.UI.
WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound Dim strState As String
Dim DL1 As DropDownList Dim item As ListItem
For Each link As System.Web.UI.WebControls.Button
In e.Item.Cells(4).Controls
link.Attributes.Add("onClick", "if
(!window.confirm('????????????'))return
false") Next End Sub
44 (9) ????DataGrid1_ItemDataBound?????????,????
????????????????????? If e.Item.ItemType
ListItemType.EditItem Then strState
e.Item.DataItem.Row("??").ToString() DL1
e.Item.FindControl("xb1") '???xb1????????????
DL1.DataSource "ds2" DL1.DataTextField
"??" DL1.DataBind()
DL1.Items.FindByText(strState).Selected True
End If (10) ??,?????
45 ?????? ?6.23 ????DataGrid??????????,?????
?????,????????????????????,???????????
???????? ????????????????,???????Visual
Basic .NET?????,??Visual Basic .NET????????Visual
Basic .NET?Web???????,??????(??????????)?????(????
????)?????(??????????)???????(????????????,???????
???????????????????????)?????????????????,???????
??????????????Web??,??????Web??????????????VS.NET?
?SQL Server??????DataGrid????????????????