当前位置: 首页 > news >正文

深圳企业网站建设哪家好网页设计与制作项目教程第二版

深圳企业网站建设哪家好,网页设计与制作项目教程第二版,share poine 户做网站,wordpress转换成 dede我写了一个控件Inherits TextBox#xff0c;里面有一个复杂属性Tip#xff0c;但每次postback的时候都说加载viewstate失败#xff0c;除非我在!postback的情况下给Tip.xxx赋值. 下面我贴出代码#xff0c;我已经搞了一天了#xff0c;搞不出什么原因。 JTextBox控件 usin…我写了一个控件Inherits TextBox里面有一个复杂属性Tip但每次postback的时候都说加载viewstate失败除非我在!postback的情况下给Tip.xxx赋值. 下面我贴出代码我已经搞了一天了搞不出什么原因。 JTextBox控件 using System;using System.Collections.Generic;using System.ComponentModel;using System.Text;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace Madou.WebControls{    [DefaultProperty(Text)]    [ParseChildren(true), PersistChildren(false)]    [ToolboxData({0}:JTextBox runatserver/{0}:JTextBox)]    public class JTextBox : System.Web.UI.WebControls.TextBox    {        public JTextBox()        {            BackColor  System.Drawing.Color.Beige;                   }        Private#regionPrivate        private ClipTipComponent _tip;        #endregion        定义属性#region定义属性        [Bindable(true)]        [Category(Behavior)]        [Description(Tip)]        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]                [PersistenceMode(PersistenceMode.InnerProperty)]        [NotifyParentProperty(true)]        public virtual ClipTipComponent Tip        {            get            {                if (_tip  null)                {                    _tip  new ClipTipComponent();                    if (IsTrackingViewState)                    {                        ((IStateManager)_tip).TrackViewState();                    }                }                return _tip;            }        }        #endregion        override#regionoverride             state management#region state management        protected override void LoadViewState(object savedState)        {            Pair p  savedState as Pair;            //HttpContext.Current.Response.Write(savedState.GetType().ToString());           // HttpContext.Current.Response.Write(savedStatenull);           // HttpContext.Current.Response.End();            if (p ! null)            {                base.LoadViewState(p.First);                ((IStateManager)Tip).LoadViewState(p.Second);                           }            else            {                base.LoadViewState(savedState);            }                  }        protected override object SaveViewState()        {            object baseState  base.SaveViewState();            object thisState  null;            if (Tip ! null)            {                thisState  ((IStateManager)Tip).SaveViewState();            }            if (thisState ! null)            {                return new Pair(baseState, thisState);            }            else            {                return baseState;            }        }        protected override void TrackViewState()        {            if (_tip ! null)            {                ((IStateManager)_tip).TrackViewState();            }            base.TrackViewState();        }        #endregion        protected override void OnPreRender(EventArgs e)        {            Tip.RegisterJs(this);            base.OnPreRender(e);        }        protected override void OnLoad(EventArgs e)        {            if (!Page.IsPostBack)            {                Tip.CloseText  关闭;            }            base.OnLoad(e);        }        #endregion    }} Tip属性类 using System;using System.Collections.Generic;using System.ComponentModel;using System.Text;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Madou.WebControls.Converter;namespace Madou.WebControls{    [TypeConverter(typeof(ClipTipComponentConverter))]    public class ClipTipComponent : IStateManager    {        Private#regionPrivate        private bool _isTrackingViewState;        private StateBag _viewState;        #endregion        public ClipTipComponent() { }        属性#region属性        [Category(Behavior)]        [DefaultValue(false)]        [Description(是否启用Ajax效果)]        [NotifyParentProperty(true)]        public bool EnabledAjax        {            get            {                return ViewState[EnabledAjax]  null ? false : Convert.ToBoolean(ViewState[EnabledAjax]);            }            set            {                ViewState[EnabledAjax]  value;            }        }              /**//// summary        /// 是否使用Tip功能        /// /summary        [Category(Behavior)]        [DefaultValue(true)]        [Description(是否使用ClipTip功能)]        [NotifyParentProperty(true)]        public bool EnabledClipTip        {            get            {                return ViewState[EnabledClipTip]  null ? true : Convert.ToBoolean(ViewState[EnabledClipTip]);            }            set            {                ViewState[EnabledClipTip]  value;            }        }        /**//// summary        /// // The width of the clueTip        /// /summary        [Category(Behavior)]        [DefaultValue(275)]        [Description(The width of the clueTip)]        [NotifyParentProperty(true)]        public string TipWidth        {            get            {                return ViewState[TipWidth]  null ? 275 : ViewState[TipWidth].ToString();            }            set            {                ViewState[TipWidth]  value;            }        }        /**//// summary        /// // The height of the clueTip.        /// /summary        [Category(Behavior)]        [DefaultValue(auto)]        [Description(The height of the clueTip)]        [NotifyParentProperty(true)]        public string TipHeigth        {            get            {                return ViewState[TipHeigth]  null ? auto : ViewState[TipHeigth].ToString();            }            set            {                ViewState[TipHeigth]  value;            }        }        /**//// summary        /// A character used to split the title attribute into the clueTip title and divs        /// /summary        [Category(Behavior)]        [DefaultValue()]        [Description(A character used to split the title attribute into the clueTip title and divs)]        [NotifyParentProperty(true)]        public string SplitTitle        {            get            {                return ViewState[SplitTitle]  null ? string.Empty : Convert.ToString(ViewState[SplitTitle]);            }            set            {                ViewState[SplitTitle]  value;            }        }        /**//// summary        /// show title bar of the clueTip, even if title attribute not set        /// /summary        [Category(Behavior)]        [DefaultValue(true)]        [Description(show title bar of the clueTip, even if title attribute not set)]        [NotifyParentProperty(true)]        public bool ShowTitle        {            get            {                return ViewState[ShowTitle]  null ? true : Convert.ToBoolean(ViewState[ShowTitle]);            }            set            {                ViewState[ShowTitle]  value;            }        }        /**//// summary        /// his is also used for a directional class on the same div, depending on where the clueTip is in relation to the invoking element. The class appears in the form of cluetip-  direction  cluetipClass. this allows you to create your own clueTip theme in a separate CSS file or use one of the three pre-packaged themes: default, jtip, or rounded.        /// /summary        [Category(Behavior)]        [DefaultValue(default)]        [Description(default, jtip, or rounded)]        [NotifyParentProperty(true)]        [Bindable(false)]        [TypeConverter(typeof(Madou.WebControls.Converter.ClueTipClassConverter))]        public string ClueTipClass        {            get            {                return ViewState[ClueTipClass]  null ? default : Convert.ToString(ViewState[ClueTipClass]);            }            set            {                ViewState[ClueTipClass]  value;            }        }        /**//// summary        /// class applied to the invoking element onmouseover and removed onmouseout        /// /summary        [Category(Behavior)]        [DefaultValue()]        [Description(class applied to the invoking element onmouseover and removed onmouseout)]        [NotifyParentProperty(true)]        public string HoverClass        {            get            {                return ViewState[HoverClass]  null ? string.Empty : Convert.ToString(ViewState[HoverClass]);            }            set            {                ViewState[HoverClass]  value;            }        }        /**//// summary        /// if true, displays arrow on appropriate side of clueTip. more info below [8]        /// /summary        [Category(Behavior)]        [DefaultValue(false)]        [Description(if true, displays arrow on appropriate side of clueTip)]        [NotifyParentProperty(true)]        public bool Arrows        {            get            {                return ViewState[Arrows]  null ? false : Convert.ToBoolean(ViewState[Arrows]);            }            set            {                ViewState[Arrows]  value;            }        }        [Category(Behavior)]        [DefaultValue(true)]        [Description(是否有Shadow)]        [NotifyParentProperty(true)]        public bool DropShadow        {            get            {                return ViewState[DropShadow]  null ? true : Convert.ToBoolean(ViewState[DropShadow]);            }            set            {                ViewState[DropShadow]  value;            }        }        [Category(Behavior)]        [DefaultValue(6)]        [Description(Shadow Steps)]        [NotifyParentProperty(true)]        public int DropShadowSteps        {            get            {                return ViewState[DropShadowSteps]  null ? 6 : Convert.ToInt32(ViewState[DropShadowSteps]);            }            set            {                ViewState[DropShadowSteps]  value;            }        }        /**//// summary        /// 如果ture,鼠标点击close才关闭        /// /summary        [Category(Behavior)]        [DefaultValue(false)]        [Description(如果ture,鼠标点击close才关闭)]        [NotifyParentProperty(true)]        public bool Sticky        {            get            {                return ViewState[Sticky]  null ? false : Convert.ToBoolean(ViewState[Sticky]);            }            set            {                ViewState[Sticky]  value;            }        }        /**//// summary        /// close when clueTip is moused out        /// /summary        [Category(Behavior)]        [DefaultValue(false)]        [Description(close when clueTip is moused out)]        [NotifyParentProperty(true)]        public bool MouseOutClose        {            get            {                return ViewState[MouseOutClose]  null ? false : Convert.ToBoolean(ViewState[MouseOutClose]);            }            set            {                ViewState[MouseOutClose]  value;            }        }        /**//// summary        ///   hoverOR click,  // set to click to force user to click to show clueTip        /// /summary        [Category(Behavior)]        [DefaultValue(hover)]        [Description(hoverOR click)]        [NotifyParentProperty(true)]        [TypeConverter(typeof(Madou.WebControls.Converter.ActivationConverter))]        public string Activation        {            get            {                return ViewState[Activation]  null ? hover : ViewState[Activation].ToString();            }            set            {                ViewState[Activation]  value;            }        }        /**//// summary        /// if true, and activation is not click, then clicking on a clueTipped link will take user to         /// the links href, even if href and tipAttribute are equal        /// /summary        [Category(Behavior)]        [DefaultValue(false)]        [Description(if true, and activation is not click)]        [NotifyParentProperty(true)]        public bool ClickThrough        {            get            {                return ViewState[ClickThrough]  null ? false : Convert.ToBoolean(ViewState[ClickThrough]);            }            set            {                ViewState[ClickThrough]  value;            }        }        /**//// summary        ///  // if true, clueTip will track mouse movement (experimental)        /// /summary        [Category(Behavior)]        [DefaultValue(false)]        [Description(if true, clueTip will track mouse movement (experimental))]        [NotifyParentProperty(true)]        public bool Tracking        {            get            {                return ViewState[Tracking]  null ? false : Convert.ToBoolean(ViewState[Tracking]);            }            set            {                ViewState[Tracking]  value;            }        }        /**//// summary        ///  close clueTip on a timed delay (experimental)        /// /summary        [Category(Behavior)]        [DefaultValue(0)]        [Description(close clueTip on a timed delay (experimental))]        [NotifyParentProperty(true)]        public int DelaydClose        {            get            {                return ViewState[DelaydClose]  null ? 0 : Convert.ToInt32(ViewState[DelaydClose]);            }            set            {                ViewState[DelaydClose]  value;            }        }        /**//// summary        /// location of close text for sticky cluetips; can be top or bottom or title        /// /summary        [Category(Behavior)]        [DefaultValue(top)]        [Description(location of close text for sticky cluetips; can be top or bottom or title)]        [NotifyParentProperty(true)]        [TypeConverter(typeof(Madou.WebControls.Converter.ClosePositionConverter))]        public string ClosePosition        {            get            {                return ViewState[ClosePosition]  null ? top : ViewState[ClosePosition].ToString();            }            set            {                ViewState[ClosePosition]  value;            }        }        [Category(Behavior)]        [DefaultValue(关闭)]        [Description(Close Text)]        [NotifyParentProperty(true)]        public string CloseText        {            get            {                return ViewState[CloseText]  null ? 关闭 : ViewState[CloseText].ToString();            }            set            {                ViewState[CloseText]  value;            }        }        /**//// summary        /// 字符数        /// /summary        [Category(Behavior)]        [DefaultValue(0)]        [Description(字符数)]        [NotifyParentProperty(true)]        public int Truncate        {            get            {                return ViewState[Truncate]  null ? 0 : Convert.ToInt32(ViewState[Truncate]);            }            set            {                ViewState[Truncate]  value;            }        }        #endregion        HELP#regionHELP        protected virtual StateBag ViewState        {            get            {                if (_viewState  null)                {                    _viewState  new StateBag(true);                    if (_isTrackingViewState)                        ((IStateManager)_viewState).TrackViewState();                }                return _viewState;            }        }                      #endregion        重写的方法#region重写的方法        public override string ToString()        {            return ToString(System.Globalization.CultureInfo.InvariantCulture);        }        public string ToString(System.Globalization.CultureInfo culture)        {            return TypeDescriptor.GetConverter(GetType()).ConvertToString(null, culture, this);        }        #endregion        IStateManager Members#region IStateManager Members        bool IStateManager.IsTrackingViewState        {            get { return _isTrackingViewState; }        }        void IStateManager.LoadViewState(object state)        {                      if (state ! null)            {                ((IStateManager)ViewState).LoadViewState(state);            }                              }        object IStateManager.SaveViewState()        {            object savedState  null;            if (_viewState ! null)            {                savedState  ((IStateManager)_viewState).SaveViewState();                                 }            else{            // HttpContext.Current.Response.Write(saveState1false);              }            return savedState;        }        void IStateManager.TrackViewState()        {            _isTrackingViewState  true;            if (_viewState ! null)            {                ((IStateManager)_viewState).TrackViewState();            }        }        #endregion                internal void SetDirty()        {            _viewState.SetDirty(true);        }       internal void RegisterJs(Control target, string clientId)        {            if (target is WebControl)            {                string tooltip  (target as WebControl).ToolTip;                if (string.IsNullOrEmpty(tooltip.Trim()))                {                    if (!EnabledAjax)                        return;                }            }                       if (EnabledClipTip)            {                JavaScriptWriter w  new JavaScriptWriter();                w.AddLine($(function());                w.OpenBlock();                if (!EnabledAjax)                {                    if (string.IsNullOrEmpty(SplitTitle))                        SplitTitle  |;                    w.AddLine($(#  clientId  ).cluetip({splitTitle:   SplitTitle  );                }                else                {                    w.AddLine($(#  clientId  ).cluetip({splitTitle: );                }                w.AddJSONItem(cluetipClass, ClueTipClass);                w.AddJSONItem(hoverClass, HoverClass);                w.AddJSONItem(arrows, Arrows);                w.AddJSONItem(dropShadow, DropShadow);                w.AddJSONItem(dropShadowSteps, DropShadowSteps);                w.AddJSONItem(sticky, Sticky);                w.AddJSONItem(mouseOutClose, MouseOutClose);                w.AddJSONItem(activation, Activation);                w.AddJSONItem(clickThrough, ClickThrough);                w.AddJSONItem(tracking, Tracking);                w.AddJSONItem(delayedClose, DelaydClose);                w.AddJSONItem(closePosition, ClosePosition);                w.AddJSONItem(width, TipWidth);                w.AddJSONItem(height, TipHeigth);                w.AddJSONItem(closeText, CloseText);                w.AddJSONItem(truncate, Truncate);                w.AddLine(}););                w.CloseBlock();                w.AddLine(););                target.Page.ClientScript.RegisterClientScriptBlock(target.GetType(), clientId, w.ToString(), false);            }        }      internal void RegisterJs(Control target)        {            string clientId  target.ClientID;            RegisterJs(target, clientId);        }    }} 出现的问题一定要在!PostBack给Tip.xxx赋值否则出现viewstate不能正常加载的错误提示(如果给JTextBox的Text赋值的话),请问这个是什么原因 bug已经发现原来System.Web.UI.WebControls.TextBox的SaveViewState()已经是Pair 转载于:https://www.cnblogs.com/genson/archive/2008/02/03/1063463.html
http://www.pierceye.com/news/955715/

相关文章:

  • 网站盗号怎么做设计说明模板200字
  • 赣州人才网站搜索引擎广告是什么
  • 广州app开发网站建设与网站优化销售
  • 做淘客哪个网站好点如何做好网站建设销售
  • 手机端网站开发视频wordpress删除评论
  • 台州网站建设推广公司随州有哪些网站建设的公司
  • 定制商品的网站建设word超链接网站怎样做
  • 南昌做网站流程安徽省建设厅网站打不开
  • 雄安智能网站建设方案做涉黄的视频网站用什么服务器
  • 公司网站必须做可信认证吗免费关键词排名优化软件
  • 基金公司网站建设网站有哪几种
  • 广州住房和城乡建设部网站首页福建建站公司
  • 福州网站制作有限公司可玩儿小程序代理
  • 佛山市企业网站建设平台注册公司多少钱起步
  • 网站开发好的语言网站维护上海
  • 民宿网站建设网站如何添加统计代码
  • 哪里培训做网站wordpress plugin development
  • 网站开发费用摊销时间html5视频教程
  • 连连跨境电商网站开发山西省住房建设厅网站首页
  • 潍坊seo网站推广北京南站地铁线路图
  • 投资网站排行军事最新新闻播报
  • 梅州建设网站丰台网页设计公司
  • 短期网站建设培训学校网页建站价格
  • 偏门网站建设做的网站被挂马
  • 三五互联网站自己做一个网站需要什么
  • wordpress博客网站深圳建工集团
  • 罗永浩做的网站房产网站设计方案
  • 创建个人网站多少钱模板速成网站
  • 晋江做网站的公司哪家好企业网站报价
  • 百度权重查询网站旅游公司的网站怎么做