internal override void InitRecursive(Control namingContainer) { HashCodeCombiner combinedHashCode = new HashCodeCombiner(); _cacheKey = ComputeNonVaryCacheKey(combinedHashCode); // Save the non-varying hash, so we don't need to recalculate it later _nonVaryHashCode = combinedHashCode.CombinedHash; PartialCachingCacheEntry cacheEntry = null; // Check if there is a cache entry for the non-varying key object tmpCacheEntry = OutputCache.GetFragment(_cacheKey, _provider); if (tmpCacheEntry != null) { ControlCachedVary cachedVary = tmpCacheEntry as ControlCachedVary; if (cachedVary != null) { string varyCachedKey = ComputeVaryCacheKey(combinedHashCode, cachedVary); // Check if there is a cache entry for the varying key cacheEntry = (PartialCachingCacheEntry)OutputCache.GetFragment(varyCachedKey, _provider); if (cacheEntry != null && cacheEntry._cachedVaryId != cachedVary.CachedVaryId) { cacheEntry = null; // explicitly remove the entry OutputCache.RemoveFragment(varyCachedKey, _provider); } } else { // If it wasn't a ControlCachedVary, it must be a PartialCachingCacheEntry cacheEntry = (PartialCachingCacheEntry)tmpCacheEntry; } } // If it's a cache miss, create the control and make it our child if (cacheEntry == null) { // Cache miss _cacheEntry = new PartialCachingCacheEntry(); _cachedCtrl = CreateCachedControl(); Controls.Add(_cachedCtrl); // Make sure the Page knows about us while the control's OnInit is called Page.PushCachingControl(this); base.InitRecursive(namingContainer); Page.PopCachingControl(); } else { // Cache hit _outputString = cacheEntry.OutputString; _cssStyleString = cacheEntry.CssStyleString; // If any calls to Register* API's were made when the control was run, // make them now to restore correct behavior (VSWhidbey 80907) if (cacheEntry.RegisteredClientCalls != null) { foreach (RegisterCallData registerCallData in cacheEntry.RegisteredClientCalls) { switch (registerCallData.Type) { case ClientAPIRegisterType.WebFormsScript: Page.RegisterWebFormsScript(); break; case ClientAPIRegisterType.PostBackScript: Page.RegisterPostBackScript(); break; case ClientAPIRegisterType.FocusScript: Page.RegisterFocusScript(); break; case ClientAPIRegisterType.ClientScriptBlocks: case ClientAPIRegisterType.ClientScriptBlocksWithoutTags: case ClientAPIRegisterType.ClientStartupScripts: case ClientAPIRegisterType.ClientStartupScriptsWithoutTags: Page.ClientScript.RegisterScriptBlock(registerCallData.Key, registerCallData.StringParam2, registerCallData.Type); break; case ClientAPIRegisterType.OnSubmitStatement: Page.ClientScript.RegisterOnSubmitStatementInternal(registerCallData.Key, registerCallData.StringParam2); break; case ClientAPIRegisterType.ArrayDeclaration: Page.ClientScript.RegisterArrayDeclaration(registerCallData.StringParam1, registerCallData.StringParam2); break; case ClientAPIRegisterType.HiddenField: Page.ClientScript.RegisterHiddenField(registerCallData.StringParam1, registerCallData.StringParam2); break; case ClientAPIRegisterType.ExpandoAttribute: Page.ClientScript.RegisterExpandoAttribute(registerCallData.StringParam1, registerCallData.StringParam2, registerCallData.StringParam3, false); break; case ClientAPIRegisterType.EventValidation: if (_registeredCallDataForEventValidation == null) { _registeredCallDataForEventValidation = new ArrayList(); } _registeredCallDataForEventValidation.Add(registerCallData); break; default: Debug.Assert(false); break; } } } base.InitRecursive(namingContainer); } }