public virtual void RenderUrlPostBackEvent(HtmlMobileTextWriter writer, String target, String argument) { writer.WriteEncodedUrl(Page.RelativeFilePath); writer.Write("?"); // Encode ViewStateID=.....&__ET=controlid&__EA=value in URL // Note: the encoding needs to be agreed with the page // adapter which handles the post back info String pageState = Page.ClientViewState; if (pageState != null) { writer.WriteUrlParameter(MobilePage.ViewStateID, pageState); writer.Write("&"); } writer.WriteUrlParameter(EventSourceKey, target); writer.Write("&"); writer.WriteUrlParameter(EventArgumentKey, argument); RenderHiddenVariablesInUrl(writer); // Unique file path suffix is used for identify if query // string text is present. Corresponding code needs to agree // on this. Even if the query string is empty, we still need // to output the suffix to indicate this. (this corresponds // to the code that handles the postback) writer.Write('&'); writer.Write(Constants.UniqueFilePathSuffixVariable); String queryStringText = Page.QueryStringText; if (queryStringText != null && queryStringText.Length > 0) { writer.Write('&'); writer.Write(queryStringText); } }
/// <include file='doc\HtmlFormAdapter.uex' path='docs/doc[@for="HtmlFormAdapter.Render"]/*' /> public override void Render(HtmlMobileTextWriter writer) { Color backColor = (Color)Style[Style.BackColorKey, true]; String title = Control.Title; bool isTitleEmpty = String.IsNullOrEmpty(title); bool willWriteHeadElements = !isTitleEmpty || RenderExtraHeadElements(null); if (willWriteHeadElements) { writer.Write("\r\n"); writer.WriteFullBeginTag("head"); } if (!isTitleEmpty) { writer.Write("\r\n"); writer.WriteFullBeginTag("title"); writer.Write(title); writer.WriteEndTag("title"); writer.Write("\r\n"); } _renderPager = true; RenderExtraHeadElements(writer); if (willWriteHeadElements) { writer.WriteEndTag("head"); writer.Write("\r\n"); } IDictionary bodyAttributes = new ListDictionary(); if ((backColor != Color.Empty) && (writer.RenderBodyColor)) { bodyAttributes.Add("bgcolor", ColorTranslator.ToHtml(backColor)); } RenderBodyTag(writer, bodyAttributes); bool formTagRequired = ShouldRenderFormTag(); if (formTagRequired) { writer.WriteBeginTag("form"); writer.WriteAttribute("id", Control.ClientID); writer.WriteAttribute("name", Control.ClientID); writer.WriteAttribute("method", Control.Method.ToString().ToLower(CultureInfo.InvariantCulture)); writer.Write(" action=\""); if (Control.Action.Length > 0) { // AUI 3652 String url = Control.ResolveUrl(Control.Action); if (!Device.SupportsQueryStringInFormAction) { // If query string is not supported, we don't write // it here, and the query string will be added as // hidden variables later. int i = url.IndexOf('?'); if (i != -1) { url = url.Substring(0, i); } } writer.Write(url); } else { writer.WriteEncodedUrl(Page.RelativeFilePath); if (Device.SupportsQueryStringInFormAction) { writer.Write("?"); writer.Write(Page.UniqueFilePathSuffix); if (Control.Method != FormMethod.Get) { String queryStringText = Page.QueryStringText; if (queryStringText != null && queryStringText.Length > 0) { writer.Write('&'); writer.Write(queryStringText); } } } } writer.Write("\""); writer.Write(">\r\n"); PageAdapter.RenderPostBackHeader(writer, Control); // Renders hidden variables for IPostBackDataHandlers which are // not displayed due to pagination or secondary UI. RenderOffPageVariables(writer, Control, Control.CurrentPage); } writer.EnterStyle(Style); writer.BeforeFirstControlWritten = true; MobileControl secondaryUIControl = SecondaryUIControl as MobileControl; if (secondaryUIControl != null && secondaryUIControl.Form == Control) { bool secondaryUIInHeaderOrFooter = IsControlInFormHeader(secondaryUIControl) || IsControlInFormFooter(secondaryUIControl); SetControlPageRecursive(secondaryUIControl, -1); if (Control.Header != null && !secondaryUIInHeaderOrFooter) { Control.Header.RenderControl(writer); } secondaryUIControl.RenderControl(writer); if (Control.Footer != null && !secondaryUIInHeaderOrFooter) { Control.Footer.RenderControl(writer); } } else { bool pagerRendered = false; if (Control.HasControls()) { foreach (Control child in Control.Controls) { if (Control.Footer == child) { RenderPager(writer); pagerRendered = true; } child.RenderControl(writer); } } if (!pagerRendered) { RenderPager(writer); } } writer.ExitStyle(Style, false); if (formTagRequired) { if (!Device.SupportsQueryStringInFormAction) { // Add query string parameters at the end of the form if // there are any RenderQueryParametersAsHiddenFields(writer); } writer.WriteEndTag("form"); } writer.WriteEndTag("body"); }