惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
Project Zero
Project Zero
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
Jina AI
Jina AI
C
Check Point Blog
博客园_首页
The GitHub Blog
The GitHub Blog
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cisco Blogs
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
A
Arctic Wolf
博客园 - 三生石上(FineUI控件)
P
Privacy International News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Forbes - Security
Forbes - Security
阮一峰的网络日志
阮一峰的网络日志
Engineering at Meta
Engineering at Meta
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
Spread Privacy
Spread Privacy
Schneier on Security
Schneier on Security
K
Kaspersky official blog
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The Register - Security
The Register - Security
P
Proofpoint News Feed
小众软件
小众软件
S
Securelist
T
Tor Project blog

博客园 - 生活即技术

好久不更新了,忙的惭愧哦,思考一个应用 利用dataTable 排序的解决方法 项目中遇到的一些小问题及解决方法 常用代码 一个com+消息队列的例子 部署Com+ 2004我的爱,2005我的期待 加密解密相关 生成略缩图 论坛在线人数统计代码 上礼拜六犯的愚蠢错误 正则表达式(1) 又一新的分页方法(转帖) 用户控件的使用(一) DataList的使用(二)自定义分页的实现 DataList的使用(1) DataGrid的使用(2)自定义分页 DataGrid的使用(1)
用户控件的使用(二)
生活即技术 · 2004-11-17 · via 博客园 - 生活即技术

这个是用引用动态的添加用户控件
UserControl.aspx

<%@ Reference Control="MyControl_.ascx" %>
<%@ register tagprefix="My" tagname="user" src="MyControl_.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="UserControls.aspx.vb" Inherits="Data.UserControls"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    
<HEAD>
        
<title>UserControls</title>
        
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    
</HEAD>
    
<body MS_POSITIONING="GridLayout">
        
<form runat="server">
            
<asp:Table Runat="server" id="Table1" style="Z-INDEX: 101; LEFT: 152px; POSITION: absolute; TOP: 80px"
                Width="104px">
                
<asp:TableRow>
                    
<asp:TableCell  ID="Cell"><asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder></asp:TableCell>
                
</asp:TableRow>
            
</asp:Table>
            
        
</form>
    
</body>
</HTML>

UserControl.aspx.vb

 Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load
        
Dim myControl As MyControl = CType(Page.LoadControl("MyControl_.ascx"), MyControl)
        myControl.MyProperty1 
= "Color"
        'Page.Controls.Add(myControl)
        Me.PlaceHolder1.Controls.Add(myControl)
        
'Table1.Controls.Add(myControl)
    End Sub

用户控件页 MyControl_.ascx

<%@ Control classname="MyControl1" Language="vb" AutoEventWireup="false" Codebehind="MyControl_.ascx.vb" Inherits="Data.MyControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<FONT face="宋体">
    
<asp:DataList id="DataList1" runat="server">
    
<ItemTemplate>
    
<%# container.dataitem("id")%>
    
    
</ItemTemplate>
        
</asp:DataList></FONT>

用户控件页 MyControl_.ascx.vb


    
Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load
        
If Not IsPostBack Then
            DataList1.DataSource 
= Databind_(0).Tables("user_login")
            DataList1.DataBind()
        
End If
    
End Sub

    
Function Databind_(ByVal StartIndex) As System.Data.DataSet
        
Dim Sqlstr As String = "server=(local);database=Achem56;uid=sa;pwd= "
        Dim Sql As String = "select   id,uname from user_login  "
        Dim Sqlconn As New System.Data.SqlClient.SqlConnection(Sqlstr)
        
Dim Sqlcmd As New System.Data.SqlClient.SqlDataAdapter(Sql, Sqlconn)
        
Dim SqlDataSet As New DataSet
        Sqlcmd.Fill(SqlDataSet, StartIndex, 
10"user_login")
        
Return SqlDataSet
    
End Function

Databin_()中的Sqlcmd.Fill()用的是返回特定大小行的记录,是从昨天写的考过来的,今天懒的写了。呵呵