Updown Control控件 分析

1,该控件重点
        事件回传,数据回传(对不太明白数据回传的请看这里:ASP.NET 2.0服务器控件之处理回传数据 )
        (a).要实现数据回传就要实现接口:IPostBackDataHandler
        (b)要实现的方法如下:
        
bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            
string presentValue = this.Text;
            
string postedValue = postCollection[HiddenID];

            
// If two values don't match, then update the value.
            if (!presentValue.Equals(postedValue))
            {
                
this.Text = postedValue;
                
// Indicate the state of this control has changed.
                return true;
            }

            
// If there was no change in the data, then indicate that there is
            
// no change in state by returning false.
            return false;
        }
void IPostBackDataHandler.RaisePostDataChangedEvent()
        {
            OnValueChanged(EventArgs.Empty);
        }
void OnValueChanged(EventArgs args)
        {
            
// If the value has been changed, raise the event.
            if (ValueChanged != null)
            {
                ValueChanged(
this, args);
            }
        }
2.界面如下
              screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片\nCTRL+Mouse 滚轮可放大/缩小';}" onclick="if(!this.resized) {return true;} else {window.open(this.src);}" height=138 src="http://www.codeproject.com/KB/user-controls/updowncontrol1/updowncontrol1.gif" width=214 onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片\nCTRL+Mouse 滚轮可放大/缩小';}" border=0>
3。代码下载
    下载

欢迎大家加入 "小强控件园" ,有更多惊喜等着你,进入小强控件园
工欲善其事,必先利其器

原文地址:https://www.cnblogs.com/HeroBeast/p/1044054.html