/// <include file='doc\WmlObjectListAdapter.uex' path='docs/doc[@for="WmlObjectListAdapter.Render"]/*' /> public override void Render(WmlMobileTextWriter writer) { switch (Control.ViewMode) { case ObjectListViewMode.List: if (Control.HasControls()) { writer.BeginCustomMarkup(); RenderChildren(writer); writer.EndCustomMarkup(); return; } RenderItemsList(writer); break; case ObjectListViewMode.Commands: RenderItemMenu(writer, Control.Selection); break; case ObjectListViewMode.Details: if (Control.Selection.HasControls()) { writer.BeginCustomMarkup(); Control.Selection.RenderChildren(writer); writer.EndCustomMarkup(); return; } RenderItemDetails(writer, Control.Selection); break; } }
/// <include file='doc\WmlFormAdapter.uex' path='docs/doc[@for="WmlFormAdapter.Render"]/*' /> public override void Render(WmlMobileTextWriter writer) { String formsAuthCookieName = FormsAuthentication.FormsCookieName; if(!Device.SupportsRedirectWithCookie) { if(!String.IsNullOrEmpty(formsAuthCookieName)) { HttpContext.Current.Response.Cookies.Remove(formsAuthCookieName); } } writer.BeginForm(Control); if (Page.Adapter.PersistCookielessData && Device.CanRenderOneventAndPrevElementsTogether && !String.IsNullOrEmpty(formsAuthCookieName) && Control == Page.ActiveForm ) { IDictionary dictionary = PageAdapter.CookielessDataDictionary; if(dictionary != null) { String value = (String)dictionary[formsAuthCookieName]; if(!String.IsNullOrEmpty(value)) { writer.AddFormVariable("__facn", value, false); } } } MobileControl secondaryUIControl = SecondaryUIControl as MobileControl; writer.EnterLayout(Style); if (secondaryUIControl != null && secondaryUIControl.Form == Control) { SetControlPageRecursive(secondaryUIControl, -1); secondaryUIControl.RenderControl(writer); } else { if (Control.HasControls()) { Panel header = Control.Header; Panel footer = Control.Footer; if (header != null) { writer.BeginCustomMarkup(); header.RenderControl(writer); writer.EndCustomMarkup(); } foreach(Control control in Control.Controls) { if (control != header && control != footer) { control.RenderControl(writer); } } RenderPager(writer); if (footer != null) { writer.BeginCustomMarkup(); footer.RenderControl(writer); writer.EndCustomMarkup(); } } else { RenderPager(writer); } } writer.ExitLayout(Style); writer.EndForm(); }
/// <include file='doc\WmlObjectListAdapter.uex' path='docs/doc[@for="WmlObjectListAdapter.RenderItemsList"]/*' /> protected virtual void RenderItemsList(WmlMobileTextWriter writer) { bool rendersAcceptsInline = Device.RendersWmlDoAcceptsInline; bool rendersSelectsAsMenuCards = Device.RendersWmlSelectsAsMenuCards; bool rendersBreaksAfterAnchor = Device.RendersBreaksAfterWmlAnchor; int pageStart = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; if (pageSize == 0 || items.Count == 0) { return; } bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresSecondScreen = HasItemDetails() || (!onlyHasDefaultCommand && HasCommands()); bool itemRequiresHyperlink = requiresSecondScreen || hasDefaultCommand; writer.EnterLayout(Style); int[] tableFieldIndices = null; if (ShouldRenderAsTable() && (tableFieldIndices = Control.TableFieldIndices).Length != 0) { writer.BeginCustomMarkup(); int fieldCount = tableFieldIndices.Length; writer.Write("<table columns=\""); writer.Write(fieldCount.ToString(CultureInfo.InvariantCulture)); writer.WriteLine("\">"); if (ShouldRenderTableHeaders()) { writer.Write("<tr>"); foreach (int fieldIndex in tableFieldIndices) { writer.Write("<td>"); writer.RenderText(Control.AllFields[fieldIndex].Title); writer.Write("</td>"); } writer.WriteLine("</tr>"); } for (int i = 0; i < pageSize; i++) { ObjectListItem item = items[pageStart + i]; writer.Write("<tr>"); for (int field = 0; field < fieldCount; field++) { writer.Write("<td>"); if (field == 0 && itemRequiresHyperlink) { RenderPostBackEvent(writer, requiresSecondScreen ? String.Format(CultureInfo.InvariantCulture, _showMoreFormatAnchor, item.Index) : item.Index.ToString(CultureInfo.InvariantCulture), GetDefaultLabel(GoLabel), false, item[tableFieldIndices[0]], false, WmlPostFieldType.Raw); } else { writer.RenderText(item[tableFieldIndices[field]]); } writer.Write("</td>"); } writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.EndCustomMarkup(); } else { int labelFieldIndex = Control.LabelFieldIndex; ObjectListField labelField = Control.AllFields[labelFieldIndex]; writer.EnterFormat(Style); for (int i = 0; i < pageSize; i++) { ObjectListItem item = items[pageStart + i]; if (itemRequiresHyperlink) { RenderPostBackEvent(writer, requiresSecondScreen ? String.Format(CultureInfo.InvariantCulture, _showMoreFormatAnchor, item.Index) : item.Index.ToString(CultureInfo.InvariantCulture), GetDefaultLabel(GoLabel), false, item[labelFieldIndex], true, WmlPostFieldType.Raw); } else { writer.RenderText(item[labelFieldIndex], true); } } writer.ExitFormat(Style); } writer.ExitLayout(Style); }