示例#1
0
        public static T GetRequiredEnumViewState <T>(StateBag viewState, string fieldName) where T : struct
        {
            T?returnValue = WebFormsHelper.GetEnumViewState <T>(viewState, fieldName);

            if (!returnValue.HasValue)
            {
                throw new Exception(string.Format("Missing required ViewState {0} value \"{1}\"", typeof(T).Name, fieldName));
            }
            return(returnValue.Value);
        }
示例#2
0
 protected T GetEnumViewState <T>(string fieldName, T defaultValue) where T : struct
 {
     return(WebFormsHelper.GetEnumViewState <T>(this.ViewState, fieldName, defaultValue));
 }
示例#3
0
        public static T GetEnumViewState <T>(StateBag viewState, string fieldName, T defaultValue) where T : struct
        {
            T?returnValue = WebFormsHelper.GetEnumViewState <T>(viewState, fieldName);

            return(returnValue.GetValueOrDefault(defaultValue));
        }
示例#4
0
 protected T?GetEnumViewState <T>(string fieldName) where T : struct
 {
     return(WebFormsHelper.GetEnumViewState <T>(this.ViewState, fieldName));
 }