|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ActiveServerPage技术为应用开发商提供了基于脚本的直观、快速、高效的应用开发手段,极大地提高了开发的效果。在讨论ASP的安全性问题之前,让我们来看看ASP是怎么工作的。示例<%@PageLanguage="VB"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<scriptrunat="server">
SubDataList1_ItemCommand(ByValsourceAsObject,ByValeAsSystem.Web.UI.WebControls.DataListCommandEventArgs)
Ife.CommandSource.ID="LinkButton1"Then
DataList1.SelectedIndex=e.Item.ItemIndex
ElseIfe.CommandSource.ID="LinkButton2"Then
ElseIfe.CommandSource.ID="LinkButton4"Then
DataList1.EditItemIndex=e.Item.ItemIndex
ElseIfe.CommandSource.ID="LinkButton3"Then
DataList1.EditItemIndex=-1
ElseIfe.CommandSource.ID="LinkButton5"Then
Response.Write("hello")
EndIf
DataList1.DataBind()
EndSub
SubDataList1_EditCommand(ByValsourceAsObject,ByValeAsSystem.Web.UI.WebControls.DataListCommandEventArgs)
DataList1.EditItemIndex=e.Item.ItemIndex
DataList1.DataBind()
EndSub
SubDataList1_CancelCommand(ByValsourceAsObject,ByValeAsSystem.Web.UI.WebControls.DataListCommandEventArgs)
Response.Write("thisistest..................dingding")
DataList1.SelectedIndex=-1
DataList1.DataBind()
EndSub
</script>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>UntitledPage</title>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:DataListID="DataList1"Runat="server"DataKeyField="ID"DataSourceID="AccessDataSource1"OnItemCommand="DataList1_ItemCommand"OnEditCommand="DataList1_EditCommand"OnCancelCommand="DataList1_CancelCommand">
<SelectedItemTemplate>
ID:
<asp:LabelID="Label1"Runat="server"Text=<%#Eval("ID")%>></asp:Label>
<br/>
art_title:
<asp:LabelID="Label2"Runat="server"Text=<%#Eval("art_title")%>></asp:Label><br/>
IP:
<asp:LabelID="Label3"Runat="server"Text=<%#Eval("IP")%>></asp:Label>
<asp:LinkButtonID="LinkButton2"Runat="server"CommandName="cancel">return</asp:LinkButton>
<asp:LinkButtonID="LinkButton4"Runat="server"CommandName="edit">edit</asp:LinkButton>
<br/>
<br/>
</SelectedItemTemplate>
<ItemTemplate>
ID:
<asp:LabelID="IDLabel"Runat="server"Text=<%#Eval("ID")%>></asp:Label>
<asp:LinkButtonID="LinkButton1"Runat="server">more</asp:LinkButton>
<br/>
<br/>
</ItemTemplate>
<EditItemTemplate>
ID:
<asp:TextBoxID="TextBox1"Runat="server"Text=<%#Eval("ID")%>></asp:TextBox>
<br/>
art_title:
<asp:TextBoxID="TextBox2"Runat="server"Text=<%#Eval("art_title")%>></asp:TextBox>
<br/>
IP:
<asp:TextBoxID="TextBox3"Runat="server"Text=<%#Eval("IP")%>></asp:TextBox>
<br/><asp:LinkButtonID="LinkButton3"Runat="server">CANCER</asp:LinkButton>
<asp:LinkButtonID="LinkButton5"Runat="server">SUBMIT</asp:LinkButton>
<br/>
</EditItemTemplate>
</asp:DataList>
<asp:AccessDataSourceID="AccessDataSource1"Runat="</p>优点:简单易学、开发速度快、有很多年“历史”,能找到非常多别人做好的程序来用、配合activeX功能强大,很多php做不到的asp+activeX能做到,例如银行安全控件 |
|