Beispiel #1
0
        private void PreRenderSmartNavigation()
        {
            ISmartNavigablePage smartNavigablePage = _page as ISmartNavigablePage;

            if (smartNavigablePage == null)
            {
                return;
            }

            NameValueCollection postBackCollection = _page.GetPostBackCollection();

            if (smartNavigablePage.IsSmartScrollingEnabled)
            {
                string smartScrollingValue = null;
                if (postBackCollection != null && !_isSmartNavigationDataDisacarded)
                {
                    smartScrollingValue = postBackCollection[c_smartScrollingID];
                }
                _page.ClientScript.RegisterHiddenField(_page, c_smartScrollingID, smartScrollingValue);
            }

            if (smartNavigablePage.IsSmartFocusingEnabled)
            {
                string smartFocusValue = null;
                if (postBackCollection != null && !_isSmartNavigationDataDisacarded)
                {
                    smartFocusValue = postBackCollection[c_smartFocusID];
                }
                if (!string.IsNullOrEmpty(_smartFocusID))
                {
                    smartFocusValue = _smartFocusID;
                }
                _page.ClientScript.RegisterHiddenField(_page, c_smartFocusID, smartFocusValue);
            }
        }
        /// <summary>
        ///   Gets the form's postback data in a fashion that works for WxePages too.
        ///   Otherwise simialar to <b>Page.Request.Form</b>.
        /// </summary>
        /// <param name="page"> The page to query for the request collection. Must not be <see langword="null"/>. </param>
        /// <returns>
        ///   The <see cref="NameValueCollection"/> returned by
        ///   <see cref="Remotion.Web.UI.ISmartPage.GetPostBackCollection">ISmartPage.GetPostBackCollection</see> or the
        ///   <see cref="HttpRequest.Form"/> collection of the <see cref="Page.Request"/>, depending on whether or not the
        ///   <paramref name="page"/> implements <see cref="IWxePage"/>.
        /// </returns>
        public static NameValueCollection GetPostBackCollection(IPage page)
        {
            ISmartPage smartPage = page as ISmartPage;

            if (smartPage != null)
            {
                return(smartPage.GetPostBackCollection());
            }
            else
            {
                return(page.Request.Form);
            }
        }