Exemplo n.º 1
0
 public static void RemoveFrom(StateBag viewState)
 {
   if (IsIn(viewState))
   {
     viewState.Remove(Key);
   }
 }
        public static StateBag DeserializeStateBag(SerializationReader reader)
        {
            var flags = reader.ReadOptimizedBitVector32();
            var stateBag = new StateBag(flags[StateBagIsIgnoreCase]);

            if (flags[StateBagHasDirtyEntries])
            {
                var count = reader.ReadOptimizedInt32();

                for(var i = 0; i < count; i++)
                {
                    var key = reader.ReadOptimizedString();
                    var value = reader.ReadObject();

            // ReSharper disable PossibleNullReferenceException
                    stateBag.Add(key, value).IsDirty = true;
            // ReSharper restore PossibleNullReferenceException
                }
            }

            if (flags[StateBagHasCleanEntries])
            {
                var count = reader.ReadOptimizedInt32();

                for(var i = 0; i < count; i++)
                {
                    var key = reader.ReadOptimizedString();
                    var value = reader.ReadObject();

                    stateBag.Add(key, value);
                }
            }
            return stateBag;
        }
Exemplo n.º 3
0
		public Style(System.Web.UI.StateBag bag) 
		{
			viewstate = bag;
			if (viewstate == null)
				viewstate = new StateBag ();
			_isSharedViewState = true;
			GC.SuppressFinalize (this);
		}
        internal void GetIdentityProviderListAsync(Uri identityProviderListServiceEndpoint)
        {
            var request = (HttpWebRequest)WebRequest.Create(identityProviderListServiceEndpoint);
            var state = new StateBag { Request = request, Callback = ParseJson };
            request.BeginGetResponse(DownloadStreamCompleted, state);
			
			var app = UIApplication.SharedApplication;
			app.NetworkActivityIndicatorVisible = true;
        }
Exemplo n.º 5
0
 public static SortDirection GetSortDirection(StateBag viewState)
 {
     SortDirection newSortDirection = SortDirection.Descending;
     object currentSortDirectionObject = viewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR];
     if (currentSortDirectionObject != null)
     {
         SortDirection currentSortDirection = (SortDirection)currentSortDirectionObject;
         newSortDirection = (currentSortDirection.Equals(SortDirection.Ascending)) ? SortDirection.Descending : SortDirection.Ascending;
     }
     return newSortDirection;
 }
    /// <summary>
    /// 文字搜尋控制項設定
    /// </summary>
    /// <param name="vs">ViewState</param>
    /// <param name="pl">搜尋 Panel 控制項</param>
    /// <param name="Title">搜尋項目標題</param>
    /// <param name="ID">控制項 ID</param>
    /// <param name="FieldName">目標欄位名稱</param>
    public Search_Checkbox(StateBag vs, Panel pl, string Title, string ID, string FieldName)
    {
        _title = Title;
        _ID = ID;
        _fieldName = FieldName;

        _viewState = vs;
        _container = pl;

        Generate();

        SearchItems.Add(new SearchItem(_ID, string.Format(" AND {0}=@0", _fieldName)));
    }
 public static void StoreDatasInViewState(FormView fv, String ID, StateBag ViewState, String ViewStateKey)
 {
     List<int> roles = new List<int>();
     CheckBoxList list = (CheckBoxList)fv.FindControl(ID);
     foreach (ListItem item in list.Items)
     {
         if (item.Selected)
         {
             roles.Add(int.Parse(item.Value));
         }
     }
     ViewState[ViewStateKey] = roles;
 }
    /// <summary>
    /// 文字搜尋控制項設定
    /// </summary>
    /// <param name="vs">ViewState</param>
    /// <param name="pl">搜尋 Panel 控制項</param>
    /// <param name="Title">搜尋項目標題</param>
    /// <param name="ID">控制項 ID</param>
    /// <param name="FieldName">目標欄位名稱</param>
    /// <param name="PlaceHolder">浮水印提示文字 (選填)</param>
    public Search_Textfield(StateBag vs, Panel pl, string Title, string ID, string FieldName, string PlaceHolder = "")
    {
        _title = Title;
        _ID = ID;
        _fieldName = FieldName;
        _placeHolder = PlaceHolder;

        _viewState = vs;
        _container = pl;

        Generate();

        SearchItems.Add(new SearchItem(_ID, string.Format(" AND {0}=@0", _fieldName)));
    }
    /// <summary>
    /// 排除重複控制項設定
    /// </summary>
    /// <param name="vs">ViewState</param>
    /// <param name="pl">搜尋 Panel 控制項</param>
    /// <param name="Title">搜尋項目標題</param>
    /// <param name="TableName">表名</param>
    /// <param name="ID">控制項 ID</param>
    /// <param name="FieldName">目標欄位名稱</param>
    public Search_Distinct(StateBag vs, Panel pl, string Title, string TableName, string PKFieldName, string ID, string FieldName)
    {
        _title = Title;
        _tableName = TableName;
        _pkFieldName = PKFieldName;
        _ID = ID;
        _fieldName = FieldName;

        _viewState = vs;
        _container = pl;

        Generate();

        SearchItems.Add(new SearchItem(_ID, string.Format(" AND {1} IN (SELECT MAX({1}) FROM {0} GROUP BY {2})", _tableName, _pkFieldName, _fieldName)));
    }
Exemplo n.º 10
0
    /// <summary>
    /// 日期搜尋控制項設定
    /// </summary>
    /// <param name="vs">ViewState</param>
    /// <param name="pl">搜尋 Panel 控制項</param>
    /// <param name="Title">搜尋項目標題</param>
    /// <param name="ToolTip">用於產生 jQuery DatePicker 的 title 值</param>
    /// <param name="DatetimeFieldName">目標欄位名稱</param>
    /// <param name="StartDateID">起始日期控制項名稱</param>
    /// <param name="EndDateID">結束日期控制項名稱</param>
    /// <param name="StartDateMaxLength">起始日期最大長度限制,預設為 10</param>
    /// <param name="EndDateMaxLength">結束日期最大長度限制,預設為 10</param>
    public Search_Date(StateBag vs, Panel pl, string Title, string ToolTip, string DatetimeFieldName, string StartDateID, string EndDateID, int StartDateMaxLength = 10, int EndDateMaxLength = 10)
    {
        _title = Title;
        _dateToolTip = ToolTip;
        _datetimeFieldName = DatetimeFieldName;
        _startDateID = StartDateID;
        _endDateID = EndDateID;
        _startDateMaxLength = StartDateMaxLength;
        _endDateMaxLength = EndDateMaxLength;

        _viewState = vs;
        _container = pl;

        Generate();
    }
Exemplo n.º 11
0
        public void StateBag()
        {
            object x = "a";
            x+="a";
            var sb = new StateBag();
            sb.Set(x,"p1",20);
            sb.Set("aa", "p1", 50);
            Assert.AreEqual(20,sb.Get(x,"p1",null));

            // Aa is interned
            Assert.IsTrue(string.IsInterned("aa")!=null);
            Assert.AreEqual(50, sb.Get("aa", "p1", null));

            sb.Remove("aa","p1");
            Assert.IsNull(sb.Get("aa", "p1", null));
        }
 /// <summary>
 /// 將搜尋控制項的值轉換為 SQL Statement
 /// </summary>
 /// <param name="sql">PetaPoco SQL</param>
 /// <param name="SearchItems">用於搜尋的控制項集合</param>
 /// <param name="plSearch">搜尋區塊控制項</param>
 /// <param name="ViewState">ViewState</param>
 public static void ConvertControlToSQL(PetaPoco.Sql sql, IList<SearchItem> SearchItems, Panel plSearch, StateBag ViewState)
 {
     foreach (SearchItem item in SearchItems)
     {
         if (((Panel)plSearch).FindControl(item.ControlName).GetType() == typeof(CheckBox))
         {
             if ((bool)ViewState[item.ControlName])
             {
                 sql.Append(item.SQLStatement, ViewState[item.ControlName]);
             }
         }
         else
         {
             if (!string.IsNullOrEmpty(Convert.ToString(ViewState[item.ControlName])))
             {
                 sql.Append(item.SQLStatement, ViewState[item.ControlName]);
             }
         }
     }
 }
    /// <summary>
    /// 將控制項的值放至 ViewState
    /// </summary>
    /// <param name="ViewState"></param>
    /// <param name="sender"></param>
    public static void Control_Binding(StateBag ViewState, object sender)
    {
        Panel Search = (Panel)sender;

        foreach (Control Control in Search.Controls)
        {
            if (Control is TextBox) // 文字輸入框
            {
                TextBox Object = (TextBox)Control;
                ViewState[Object.ID] = Object.Text;
            }
            else if (Control is DropDownList) // 下拉選單
            {
                DropDownList Object = (DropDownList)Control;
                ViewState[Object.ID] = Object.SelectedValue;
            }
            else if (Control is CheckBox) // 核取方塊
            {
                CheckBox Object = (CheckBox)Control;
                ViewState[Object.ID] = Object.Checked;
            }
        }
    }
Exemplo n.º 14
0
 public static bool GetViewStateBoolValue(StateBag viewState, string valueName, bool defaultValue)
 {
     return(WebHelper.GetViewStateBoolValue(viewState, valueName, defaultValue, false));
 }
Exemplo n.º 15
0
 public static double GetViewStateDoubleValue(StateBag viewState, string valueName, double defaultValue)
 {
     return(WebHelper.GetViewStateDoubleValue(viewState, valueName, defaultValue, false));
 }
Exemplo n.º 16
0
 public static float GetViewStateFloatValue(StateBag viewState, string valueName, float defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateValue <float>(viewState, valueName, defaultValue, float.TryParse));
 }
Exemplo n.º 17
0
 public static float GetViewStateFloatValue(StateBag viewState, string valueName)
 {
     return(WebHelper.GetViewStateFloatValue(viewState, valueName, float.NaN));
 }
 /// <devdoc>
 /// <para>Initializes a new instance of the System.Web.UI.WebControls.Field class.</para>
 /// </devdoc>
 protected DataControlField() {
     _statebag = new StateBag();
     _dataSourceViewSchema = null;
 }
Exemplo n.º 19
0
 public GetObjectWriter(ObjectAssembler objectAssembler)
 {
     this.objectAssembler = objectAssembler;
     bag = objectAssembler.Bag;
 }
Exemplo n.º 20
0
 public static T GetViewStateValue <T>(StateBag viewState, string valueName, T defaultValue, TryParseHandler <T> handler)
 //where T : struct
 {
     return(WebHelper.GetViewStateValue <T>(viewState, valueName, defaultValue, false, handler));
 }
Exemplo n.º 21
0
 internal /*public*/ ListDataHelper(IListControl parent, StateBag parentViewState)
 {
     _parent = parent;
     _parentViewState = parentViewState;
 }
Exemplo n.º 22
0
 public StartMemberWriter(ObjectAssembler objectAssembler)
 {
     this.objectAssembler = objectAssembler;
     bag = objectAssembler.Bag;
 }
Exemplo n.º 23
0
 public static void Message_Load(Label lbl, StateBag ViewState, String Key)
 {
     if (ViewState[Key] != null)
     {
       lbl.Text = (String)ViewState[Key];
     }
     ViewState.Remove(Key);
 }
Exemplo n.º 24
0
        private void Serialize(StateBag stateBag)
        {
            var serializer =
                new XmlSerializer(typeof(StateBag));

            using (var fs = File.Create(FileName))
                serializer.Serialize(fs, stateBag);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Сохраняет избранное, прочитанное и маркеры...
        /// </summary>
        /// <param name="options">Опции сохранения.</param>
        public void SaveState(SaveStateOptions options)
        {
            if (options == SaveStateOptions.None)
                return;

            using (var db = _serviceProvider.CreateDBContext())
            {
                var state = new StateBag
                {
                    MaxMessageId = db.Messages().Max(msg => msg.ID)
                };

                if ((options & SaveStateOptions.ReadedMessages) != SaveStateOptions.None)
                    state.UnreadMessages =
                        db
                            .Messages(m => !m.IsRead)
                            .Select(m => m.ID)
                            .ToList();

                if ((options & SaveStateOptions.Markers) != SaveStateOptions.None)
                {
                    state.MarkedMessages =
                        db
                            .Messages(m => m.IsMarked)
                            .Select(m => m.ID)
                            .ToList();
                    state.MarkedTopics =
                        db
                            .TopicInfos(ti => ti.AnswersMarked > 0)
                            .Select(ti => ti.MessageID)
                            .ToList();
                }

                if ((options & SaveStateOptions.Favorites) != SaveStateOptions.None)
                    state.Favorites = GetFavorites(_favManager.RootFolder);

                Serialize(state);
            }
        }
 public CloseToolbarButtonStyle(StateBag state)
     : base(state)
 {
 }
 public AutoGeneratedFieldProperties() {
     _statebag = new StateBag();
 }
Exemplo n.º 28
0
 public static DateTime GetViewStateDateTimeValue(StateBag viewState, string valueName)
 {
     return(WebHelper.GetViewStateDateTimeValue(viewState, valueName, DateTime.MinValue));
 }
Exemplo n.º 29
0
 public static DateTime GetViewStateDateTimeValue(StateBag viewState, string valueName, DateTime defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateValue <DateTime>(viewState, valueName, defaultValue, throwExceptionIfNull, DateTime.TryParse));
 }
Exemplo n.º 30
0
 public static SearchData Load(StateBag viewstate)
 {
     return(viewstate["SearchData"] as SearchData);
 }
Exemplo n.º 31
0
 public static int GetInteger(this StateBag viewState, string valueName, int defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateIntValue(viewState, valueName, defaultValue, throwExceptionIfNull));
 }
        public void SetUp()
        {
            Initialize();

            _resourceSet = new BocBooleanValueResourceSet(
                "ResourceKey",
                "TrueIconUrl",
                "FalseIconUrl",
                "NullIconUrl",
                "DefaultTrueDescription",
                "DefaultFalseDescription",
                "DefaultNullDescription"
                );

            _booleanValue = MockRepository.GenerateMock <IBocBooleanValue>();

            var clientScriptManagerMock = MockRepository.GenerateMock <IClientScriptManager>();

            _booleanValue.Stub(mock => mock.ClientID).Return(c_clientID);
            _booleanValue.Stub(stub => stub.ControlType).Return("BocBooleanValue");
            _booleanValue.Stub(mock => mock.GetValueName()).Return(c_keyValueName);
            _booleanValue.Stub(mock => mock.GetDisplayValueName()).Return(c_displayValueName);

            string startupScriptKey = typeof(BocBooleanValueRenderer).FullName + "_Startup_" + _resourceSet.ResourceKey;

            _startupScript = string.Format(
                "BocBooleanValue_InitializeGlobals ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}');",
                _resourceSet.ResourceKey,
                "true",
                "false",
                "null",
                ScriptUtility.EscapeClientScript(_resourceSet.DefaultTrueDescription),
                ScriptUtility.EscapeClientScript(_resourceSet.DefaultFalseDescription),
                ScriptUtility.EscapeClientScript(_resourceSet.DefaultNullDescription),
                _resourceSet.TrueIconUrl,
                _resourceSet.FalseIconUrl,
                _resourceSet.NullIconUrl);
            clientScriptManagerMock.Expect(mock => mock.RegisterStartupScriptBlock(_booleanValue, typeof(BocBooleanValueRenderer), startupScriptKey, _startupScript));
            clientScriptManagerMock.Stub(mock => mock.IsStartupScriptRegistered(Arg <Type> .Is.NotNull, Arg <string> .Is.NotNull)).Return(false);
            clientScriptManagerMock.Stub(mock => mock.GetPostBackEventReference(_booleanValue, string.Empty)).Return(c_postbackEventReference);

            _clickScript =
                "BocBooleanValue_SelectNextCheckboxValue ('ResourceKey', $(this).parent().children('a').children('img').first()[0], " +
                "$(this).parent().children('span').first()[0], $(this).parent().children('input').first()[0], false, " +
                "'" + c_trueDescription + "', '" + c_falseDescription + "', '" + c_nullDescription + "');return false;";

            _keyDownScript = "BocBooleanValue_OnKeyDown (this);";

            var pageStub = MockRepository.GenerateStub <IPage>();

            pageStub.Stub(stub => stub.ClientScript).Return(clientScriptManagerMock);

            _booleanValue.Stub(mock => mock.Value).PropertyBehavior();
            _booleanValue.Stub(mock => mock.IsDesignMode).Return(false);
            _booleanValue.Stub(mock => mock.ShowDescription).Return(true);

            _booleanValue.Stub(mock => mock.Page).Return(pageStub);
            _booleanValue.Stub(mock => mock.TrueDescription).Return(c_trueDescription);
            _booleanValue.Stub(mock => mock.FalseDescription).Return(c_falseDescription);
            _booleanValue.Stub(mock => mock.NullDescription).Return(c_nullDescription);

            _booleanValue.Stub(mock => mock.CssClass).PropertyBehavior();

            StateBag stateBag = new StateBag();

            _booleanValue.Stub(mock => mock.Attributes).Return(new AttributeCollection(stateBag));
            _booleanValue.Stub(mock => mock.Style).Return(_booleanValue.Attributes.CssStyle);
            _booleanValue.Stub(mock => mock.LabelStyle).Return(new Style(stateBag));
            _booleanValue.Stub(mock => mock.ControlStyle).Return(new Style(stateBag));

            _booleanValue.Stub(stub => stub.CreateResourceSet()).Return(_resourceSet);
        }
Exemplo n.º 33
0
		protected override void LoadViewState (object savedState) 
		{
			if (savedState == null || !(savedState is Pair)) {
				base.LoadViewState (null);
				return;
			}

			Pair pair = (Pair) savedState;
			
			base.LoadViewState (pair.First);
			if (ViewState [System.Web.UI.WebControls.Style.BitStateKey] != null)
				ControlStyle.LoadBitState ();

			if (pair.Second != null) {
				if (attribute_state == null) {
					attribute_state = new StateBag ();
					if (IsTrackingViewState) 
						attribute_state.TrackViewState ();
				}

				attribute_state.LoadViewState (pair.Second);
				attributes = new AttributeCollection(attribute_state);
			}

			enabled = ViewState.GetBool ("Enabled", enabled);
		}
Exemplo n.º 34
0
 public static void TrySaveInSessionState <T>(Page page, Control control, StateBag alternate, string key, T value)
 {
     key += control.UniqueID;
     TrySaveInSessionState(page, alternate, key, value);
 }
Exemplo n.º 35
0
 public static int GetViewStateIntValue(StateBag viewState, string valueName, int defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateValue <int>(viewState, valueName, defaultValue, throwExceptionIfNull, int.TryParse));
 }
Exemplo n.º 36
0
 public static T TryGetFromSessionState <T>(Page page, Control control, StateBag alternate, string key, T value)
 {
     key  += control.UniqueID;
     value = TryGetFromSessionState(page, alternate, key, value);
     return(value);
 }
Exemplo n.º 37
0
 public static float GetViewStateFloatValue(StateBag viewState, string valueName, float defaultValue)
 {
     return(WebHelper.GetViewStateFloatValue(viewState, valueName, defaultValue, false));
 }
Exemplo n.º 38
0
 public MyTreeNode()
 {
     this.ViewState = new StateBag();
     this.depth     = -1;
     this.nodes     = null;
 }
Exemplo n.º 39
0
 public static double GetViewStateDoubleValue(StateBag viewState, string valueName)
 {
     return(WebHelper.GetViewStateDoubleValue(viewState, valueName, double.NaN));
 }
Exemplo n.º 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteOptions"/> class.
 /// </summary>
 /// <param name="noteContainer">The note container.</param>
 public NoteOptions(NoteContainer noteContainer)
 {
     _containerViewState = noteContainer?.ContainerViewState ?? new StateBag();
     _noteTypeIds        = new List <int>();
 }
Exemplo n.º 41
0
 public static double GetViewStateDoubleValue(StateBag viewState, string valueName, double defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateValue <double>(viewState, valueName, defaultValue, double.TryParse));
 }
Exemplo n.º 42
0
 public EditorStyle(StateBag state)
     : base(state)
 {
 }
Exemplo n.º 43
0
 public static bool GetViewStateBoolValue(StateBag viewState, string valueName, bool defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateValue <bool>(viewState, valueName, defaultValue, throwExceptionIfNull, bool.TryParse));
 }
Exemplo n.º 44
0
        protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver)
        {
            // The main style will be rendered on the container element, that does not contain the text.
            // The Hyperlink style will render the text styles
            // Copying the code from the base class, except for the part that deals with Font and ForeColor.
            StateBag viewState = ViewState;
            Color    c;

            // BackColor
            if (IsSet(PROP_BACKCOLOR))
            {
                c = (Color)viewState["BackColor"];
                if (!c.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(c));
                }
            }

            // BorderColor
            if (IsSet(PROP_BORDERCOLOR))
            {
                c = (Color)viewState["BorderColor"];
                if (!c.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(c));
                }
            }

            BorderStyle bs = this.BorderStyle;
            Unit        bu = this.BorderWidth;

            if (!bu.IsEmpty)
            {
                attributes.Add(HtmlTextWriterStyle.BorderWidth, bu.ToString(CultureInfo.InvariantCulture));
                if (bs == BorderStyle.NotSet)
                {
                    if (bu.Value != 0.0)
                    {
                        attributes.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                    }
                }
                else
                {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }
            else
            {
                if (bs != BorderStyle.NotSet)
                {
                    attributes.Add(HtmlTextWriterStyle.BorderStyle, borderStyles[(int)bs]);
                }
            }

            Unit u;

            // Height
            if (IsSet(PROP_HEIGHT))
            {
                u = (Unit)viewState["Height"];
                if (!u.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Height, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            // Width
            if (IsSet(PROP_WIDTH))
            {
                u = (Unit)viewState["Width"];
                if (!u.IsEmpty)
                {
                    attributes.Add(HtmlTextWriterStyle.Width, u.ToString(CultureInfo.InvariantCulture));
                }
            }

            if (!HorizontalPadding.IsEmpty || !VerticalPadding.IsEmpty)
            {
                attributes.Add(HtmlTextWriterStyle.Padding, string.Format(CultureInfo.InvariantCulture,
                                                                          "{0} {1} {0} {1}",
                                                                          VerticalPadding.IsEmpty ? Unit.Pixel(0) : VerticalPadding,
                                                                          HorizontalPadding.IsEmpty ? Unit.Pixel(0) : HorizontalPadding));
            }
        }
Exemplo n.º 45
0
 public static DateTime GetViewStateDateTimeValue(StateBag viewState, string valueName, DateTime defaultValue)
 {
     return(WebHelper.GetViewStateDateTimeValue(viewState, valueName, defaultValue, false));
 }
Exemplo n.º 46
0
 public TreeNodeStyle(StateBag bag) : base(bag)
 {
 }
Exemplo n.º 47
0
 public static T GetViewStateValue <T>(StateBag viewState, string valueName)
 //where T : struct
 {
     return(WebHelper.GetViewStateValue <T>(viewState, valueName, default(T), true, null));
 }
Exemplo n.º 48
0
		protected override void LoadViewState (object savedState)
		{
			if (savedState == null) {
				base.LoadViewState (null);
				return;
			}

			Triplet saved = (Triplet) savedState;
			base.LoadViewState (saved.First);

			if (saved.Second != null) {
				if (inputAttributesState == null) {
					inputAttributesState = new StateBag(true);
					inputAttributesState.TrackViewState ();
				}
				inputAttributesState.LoadViewState (saved.Second);
			}

			if (saved.Third != null) {
				if (labelAttributesState == null) {
					labelAttributesState = new StateBag(true);
					labelAttributesState.TrackViewState ();
				}
				labelAttributesState.LoadViewState (saved.Third);
			}
		}
Exemplo n.º 49
0
 public static int GetInteger(this StateBag viewState, string valueName, int defaultValue)
 {
     return(WebHelper.GetViewStateIntValue(viewState, valueName, defaultValue));
 }
Exemplo n.º 50
0
		internal void LoadViewState (object state)
		{
			if (state == null)
				return;

			object [] states = (object []) state;

			if (states [0] != null) {
				sb = new StateBag (true);
				sb.LoadViewState (states[0]);
				sb.SetDirty (true);
			}
			
			if (states [1] != null)
				text = (string) states [1];
			if (states [2] != null)
				value = (string) states [2];
			if (states [3] != null)
				selected = (bool) states [3];
			if (states [4] != null)
				enabled = (bool) states [4];
		}
Exemplo n.º 51
0
 public StartObjectWriter(ObjectAssembler objectAssembler, object rootInstance = null)
 {
     this.objectAssembler = objectAssembler;
     this.rootInstance = rootInstance;
     bag = objectAssembler.Bag;
 }
Exemplo n.º 52
0
 public static void StoreSelectedItemsInViewState(ListBox lb, StateBag ViewState, String Key)
 {
     List<ListItem> list = new List<ListItem>();
     foreach (ListItem item in lb.Items)
     {
       list.Add(item);
     }
     ViewState[Key] = list;
 }
Exemplo n.º 53
0
 public static bool GetBoolean(this StateBag viewState, string valueName, bool defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateBoolValue(viewState, valueName, defaultValue, throwExceptionIfNull));
 }
Exemplo n.º 54
0
 public static DateTime GetDateTime(this StateBag viewState, string valueName, DateTime defaultValue, bool throwExceptionIfNull)
 {
     return(WebHelper.GetViewStateDateTimeValue(viewState, valueName, defaultValue, throwExceptionIfNull));
 }
Exemplo n.º 55
0
		protected DataGridColumn ()
		{
			viewstate = new StateBag ();
		}
Exemplo n.º 56
0
 public static T GetValue <T>(this StateBag viewState, string valueName, T defaultValue, bool throwExceptionIfNull, TryParseHandler <T> handler)
     where T : struct
 {
     return(WebHelper.GetViewStateValue <T>(viewState, valueName, defaultValue, throwExceptionIfNull, handler));
 }
Exemplo n.º 57
0
		public Style()
		{
			viewstate = new StateBag ();
			GC.SuppressFinalize (this);
		}
Exemplo n.º 58
0
 public static int GetViewStateIntValue(StateBag viewState, string valueName)
 {
     return(WebHelper.GetViewStateIntValue(viewState, valueName, 0));
 }
Exemplo n.º 59
0
 public static void SetValue(this StateBag viewState, String key, Object value)
 {
     viewState[key] = value;
 }
Exemplo n.º 60
0
 /// <devdoc>
 ///   Creates a new instance of PagerSettings.
 /// </devdoc>
 public PagerSettings() {
     _viewState = new StateBag();
 }