|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
强大的可扩展性。ASP具有强大的扩展性,可以实现与多种网络、硬件设备的连接:通过专用的通讯线路远程接入企业;通过远程拨号服务器为远程拨号客户提供服务;通过WAP为移动电话互联网客户服务。分页|示例<%@PageLanguage="VB"%>
<%@importNamespace="System.Data"%>
<scriptrunat="server">
SubPage_Load(ByValSenderAsObject,ByValeAsEventArgs)
DimPgdsAsPagedDataSource=NewPagedDataSource
Pgds.DataSource=CreateDataSource().DefaultView
Pgds.AllowPaging=True
Pgds.PageSize=6
lblTotalPage.Text=Pgds.PageCount.ToString()
DimCurrentPageAsInteger
IfNotRequest.QueryString("Page")IsNothingThen
CurrentPage=Convert.ToInt32(Request.QueryString("Page"))
Else
CurrentPage=1
EndIf
Pgds.CurrentPageIndex=CurrentPage-1
lblCurrentPage.Text=CurrentPage.ToString()
IfNotPgds.IsFirstPageThen
lnkPrev.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(CurrentPage-1)
EndIf
IfNotPgds.IsLastPageThen
lnkNext.NavigateUrl=Request.CurrentExecutionFilePath+"?Page="+Convert.ToString(CurrentPage+1)
EndIf
Repeater1.DataSource=Pgds
Repeater1.DataBind()
EndSub
FunctionCreateDataSource()AsDatatable
DimdtAsDataTable
DimdrAsDataRow
DimiAsInteger
dt=NewDataTable
dt.Columns.Add(NewDataColumn("IntegerValue",GetType(Integer)))
dt.Columns.Add(NewDataColumn("StringValue",GetType(String)))
dt.Columns.Add(NewDataColumn("DateTimeValue",GetType(DateTime)))
dt.Columns.Add(NewDataColumn("BoolValue",GetType(Boolean)))
Fori=0To50
dr=dt.NewRow()
dr(0)=i
dr(1)="Item"+i.ToString()
dr(2)=DateTime.Now.ToShortTimeString
If(iMod20)Then
dr(3)=True
Else
dr(3)=False
EndIf
dt.Rows.Add(dr)
Next
Returndt
EndFunction
</script>
<html>
<head>
<title>DataRepeater</title>
<styletype=text/CSS>
BODY{FONT:10pxVerdana,Arial,Helvetica,"sansserif";COLOR:#000000;}
.txt{FONT-SIZE:12px}
</style>
</head>
<body>
<formid="Form1"name=form1method=postrunat="server">
<tableclass=txtwidth="100%"border=0>
<tbody>
<tr>
<td><asp:hyperlinkid=lnkPrevrunat="server">上页</asp:hyperlink><asp:hyperlinkid=lnkNextrunat="server">下页</asp:hyperlink>
第
<asp:labelid=lblCurrentPagerunat="server"></asp:label>
页共
<asp:labelid=lblTotalPagerunat="server"></asp:label>
页</td>
</tr></tbody>
</table>
<asp:repeaterID=Repeater1runat="server">
<itemtemplate>
<hralign="left"width="60%"size="1">
<tableclass=txtwidth="100%"border="0">
<tr>
<td>OrderDate:
<%#DataBinder.Eval(Container.DataItem,"DateTimeValue","{0:d}")%></td>
<tr>
<td>Quantity:
<%#DataBinder.Eval(Container.DataItem,"IntegerValue","{0:N2}")%></td>
<tr>
<td>Item:
<%#DataBinder.Eval(Container.DataItem,"StringValue")%></td>
<tr>
<td>OrderDate:
<asp:checkboxid="chk1"checked=<%#DataBinder.Eval(Container.DataItem,"BoolValue")%>runat="server"/>
</td>
</tr>
</table>
</itemtemplate>
</asp:repeater>
<hrhight="1">
</form>
</body>
</html>
</p>缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。 |
|