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

推荐订阅源

The Last Watchdog
The Last Watchdog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 热门话题
G
GRAHAM CLULEY
S
Schneier on Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
IT之家
IT之家
阮一峰的网络日志
阮一峰的网络日志
Recorded Future
Recorded Future
I
Intezer
云风的 BLOG
云风的 BLOG
博客园 - Franky
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
T
Tenable Blog
The Hacker News
The Hacker News
T
The Blog of Author Tim Ferriss
Attack and Defense Labs
Attack and Defense Labs
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
News and Events Feed by Topic
有赞技术团队
有赞技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
News and Events Feed by Topic
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
Webroot Blog
Webroot Blog
W
WeLiveSecurity
H
Heimdal Security Blog
博客园 - 三生石上(FineUI控件)
V
Vulnerabilities – Threatpost
G
Google Developers Blog
O
OpenAI News
V
V2EX
罗磊的独立博客
博客园_首页
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
TaoSecurity Blog
TaoSecurity Blog
Cloudbric
Cloudbric
H
Hacker News: Front Page
博客园 - 叶小钗
T
Tor Project blog
AI
AI

博客园 - 让心灵去旅行

在Javascript中用command模式模拟多线程,包含注释 项目小结 sql语句性能提高 oracle的异常 简单的消息发送小程序 XP风格进度条 随机抽取不重复的数据 xmlhttp实现无刷新页面 VS.Net 2005中文版下载地址收藏 在线统计与跟踪(新) 简单ocx控件制作方法(原创) 可以双击的DataGrid 权限管理的方案(只有实现思想) 收藏几段SQL Server语句和存储过程(转载) 动态添加和删除行 键盘各键对应的键值 只能输入数值的输入框 操作动态表格的控件 模仿QQ的菜单滚动效果
自己做控件小例子
让心灵去旅行 · 2005-08-02 · via 博客园 - 让心灵去旅行

自己做控件小例子

自己做控件,也很容易。贴出来,给初学的人提供经验

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.ComponentModel;

namespace ISDReport.control
{    
    
public class DemoLinkButton:System.Web.UI.WebControls.WebControl,IPostBackEventHandler
    
{    
        
public DemoLinkButton()
        
{
        }

    
        [Bindable(
false),
        Category(
"Appearance"), 
        DefaultValue(
"")] 
        
        
public string Text 
        
{
            
get
            
{
                
string _text = (string)ViewState["Text"];
                
return _text==null?"":_text;
            }

            
set
            
{
                ViewState[
"Text"= value;
            }

        }


        
protected override void OnPreRender(System.EventArgs e)
        
{
             
string scriptClick="<script language='javascript'>function DoOnClick(){"
                 
+((HyperLinkClicked==null)?"":(Page.GetPostBackClientEvent(this,"Clicked"))
                 
+"; return;}</script>");
            Page.RegisterClientScriptBlock(
"OnClicked",scriptClick);
        }


        
protected override void Render(HtmlTextWriter writer)
        
{
            
if(this.Text=="")
            
{
                writer.Write(
"<a href=\"javascript:DoOnClick();\" id=\""+this.ClientID+"\">DemoLinkButton</a>");
            }

            
else{
                writer.Write(
"<a href=\"javascript:DoOnClick();\" id=\""+this.ClientID+"\">"+this.Text+"</a>");
            }

        }


        
public void RaisePostBackEvent(string eventArgument)
        
{
            
if(eventArgument=="Clicked")  HyperLinkClicked(this,System.EventArgs.Empty);
        }
            


        
public delegate void HyperLinkClickedHandle(object sender,System.EventArgs e);
        
public event HyperLinkClickedHandle HyperLinkClicked;

    }

}

posted @ 2005-08-02 11:00  让心灵去旅行  阅读(907)  评论(4)    收藏  举报