BExIS.Web.Shell.Areas.SAM.Helpers.HtmlPrefixScopeExtensions.GetIdsToReuse C# (CSharp) Method

GetIdsToReuse() private static method

private static GetIdsToReuse ( System.Web.HttpContextBase httpContext, string collectionName ) : Queue
httpContext System.Web.HttpContextBase
collectionName string
return Queue
        private static Queue<string> GetIdsToReuse(HttpContextBase httpContext, string collectionName)
        {
            // We need to use the same sequence of IDs following a server-side validation failure,
            // otherwise the framework won't render the validation error messages next to each item.
            string key = idsToReuseKey + collectionName;
            var queue = (Queue<string>)httpContext.Items[key];
            if (queue == null)
            {
                httpContext.Items[key] = queue = new Queue<string>();
                var previouslyUsedIds = httpContext.Request[collectionName + ".index"];
                if (!string.IsNullOrEmpty(previouslyUsedIds))
                    foreach (string previouslyUsedId in previouslyUsedIds.Split(','))
                        queue.Enqueue(previouslyUsedId);
            }
            return queue;
        }