Ejemplo n.º 1
0
        private void AddStyleToCollection(string idx, string value, bool viewStateOnly)
        {
            string styleName  = idx.Trim().ToLowerInvariant();
            string styleValue = value.Trim();

            if (styleName == "opacity")
            {
                decimal opacity;

                // use full opacity if the user didn't specify a correct value
                if (!decimal.TryParse(styleValue, NumberStyles.Float, CultureInfo.InvariantCulture, out opacity))
                {
                    opacity = 1.0M;
                }
                styleValue = opacity.ToString(CultureInfo.InvariantCulture);
            }

            if (_styleValues.ContainsKey(styleName))
            {
                // Key exists from before
                StyleValue oldValue = _styleValues[styleName];
                if (viewStateOnly)
                {
                    oldValue.OnlyViewStateValue = styleValue;
                }
                else
                {
                    if (_trackingViewState)
                    {
                        oldValue.AfterViewStateTrackingValue = styleValue;
                    }
                    else
                    {
                        oldValue.BeforeViewStateTrackingValue = styleValue;
                    }
                }
            }
            else
            {
                // Key doesn't exist from before
                StyleValue nValue = new StyleValue();
                if (viewStateOnly)
                {
                    nValue.OnlyViewStateValue = styleValue;
                }
                else
                {
                    if (_trackingViewState)
                    {
                        nValue.AfterViewStateTrackingValue = styleValue;
                    }
                    else
                    {
                        nValue.BeforeViewStateTrackingValue = styleValue;
                    }
                }
                _styleValues[styleName] = nValue;
            }
        }
Ejemplo n.º 2
0
        internal void LoadViewState(string state)
        {
            if (string.IsNullOrEmpty(state))
            {
                return;
            }
            state = state.Trim();

            string[] stylePairs = state.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string idx in stylePairs)
            {
                string[]   raw = idx.Split(':');
                StyleValue v   = new StyleValue();
                v.ViewStateValue     = raw[1];
                _styleValues[raw[0]] = v;
            }
        }
Ejemplo n.º 3
0
        private void AddStyleToCollection(string idx, string value, bool viewStateOnly)
        {
            string styleName = idx.Trim().ToLowerInvariant();
            string styleValue = value.Trim ();
            
            if (styleName == "opacity")
            {
                decimal opacity;
                
                // use full opacity if the user didn't specify a correct value
                if (!decimal.TryParse(styleValue, NumberStyles.Float, CultureInfo.InvariantCulture, out opacity))
                    opacity = 1.0M;
                styleValue = opacity.ToString(CultureInfo.InvariantCulture);
            }

            if (_styleValues.ContainsKey(styleName))
            {
                // Key exists from before
                StyleValue oldValue = _styleValues[styleName];
                if (viewStateOnly)
                {
                    oldValue.OnlyViewStateValue = styleValue;
                }
                else
                {
                    if (_trackingViewState)
                        oldValue.AfterViewStateTrackingValue = styleValue;
                    else
                        oldValue.BeforeViewStateTrackingValue = styleValue;
                }
            }
            else
            {
                // Key doesn't exist from before
                StyleValue nValue = new StyleValue();
                if (viewStateOnly)
                {
                    nValue.OnlyViewStateValue = styleValue;
                }
                else
                {
                    if (_trackingViewState)
                        nValue.AfterViewStateTrackingValue = styleValue;
                    else
                        nValue.BeforeViewStateTrackingValue = styleValue;
                }
                _styleValues[styleName] = nValue;
            }
        }
Ejemplo n.º 4
0
        internal void LoadViewState(string state)
        {
            if (string.IsNullOrEmpty(state))
                return;
            state = state.Trim();

            string[] stylePairs = state.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            
            foreach (string idx in stylePairs)
            {
                string[] raw = idx.Split(':');
                StyleValue v = new StyleValue();
                v.ViewStateValue = raw[1];
                _styleValues[raw[0]] = v;
            }
        }