PRB: The Rendering of the ObjectList Control Varies on the Openwave UP.Simulator 4.1 Emulator (312098)



The information in this article applies to:

  • Microsoft Mobile Internet Toolkit (MMIT)

This article was previously published under Q312098

SYMPTOMS

The rendering of the ObjectList control varies on the Openwave UP.Simulator 4.1 Emulator. You have to use different markup to render the ObjectList control on the Openwave UP.Simulator 4.1 emulator depending on the value of the TableFields property.

RESOLUTION

To work around this behavior, use the following list of settings and markups for the ObjectList control when rendering on the Openwave UP.Simulator 4.1 emulator:
  • If you do not use the TableFields property of the ObjectList control, the UP.Simulator 4.1 emulator renders the ObjectList as a <select> tag with each item in the list as an <option> tag.
  • If you set the TableFields property of the ObjectList control to only one field, the UP.Simulator 4.1 emulator renders the ObjectList as a <table> tag with each item in the list as an <anchor> tag.
  • If the number of fields in the TableFields property of the ObjectList control results in a table that is too wide for the screen, the TableFields property is ignored and the ObjectList is rendered as a <select> tag with each item in the list as an <option> tag.

MORE INFORMATION

Steps to Reproduce the Behavior

The following code adds four items to the ObjectList control. To reproduce the behavior, uncomment each of the lines of code (separately) that set the TableFields property, and then run the page. The control generates different markup depending on which line you uncomment.
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>
<%@ Page language="c#" Inherits="System.Web.UI.MobileControls.MobilePage" AutoEventWireup="true" %>

<body xmlns:mobile="Mobile Web Form Controls">
    <mobile:Form id=Form1 runat="server">
		<mobile:ObjectList id=ObjectList1 runat="server" AutoGenerateFields="False">
			<Field Name="FN" Title="First Name" DataField="FirstName"/>
			<Field Name="LN" Title="Last Name" DataField="LastName"/>
			<Field Name="A" Title="Age" DataField="Age"/>			
		</mobile:ObjectList>
    </mobile:Form>
</body>

<script runat=server>
void Page_Load(Object sender, EventArgs e)
{
	if(!IsPostBack)
	{	
		//ObjectList1.TableFields="FN";
		//ObjectList1.TableFields="FN;LN";
		//ObjectList1.TableFields="FN;LN;A";
		
		ObjectList1.DataSource = CreateData();	
		ObjectList1.DataBind();	
	}	
}

public ArrayList CreateData()
{
	ArrayList arr = new ArrayList();
	arr.Add(new CustomDataObject("Nancy", "Davilio", "53"));
	arr.Add(new CustomDataObject("Andrew", "Fuller", "33"));
	arr.Add(new CustomDataObject("Anne", "Dodsworth", "32"));		
	arr.Add(new CustomDataObject("Janet", "Leverling", "27"));

	return arr;
}

public class CustomDataObject
{
	private String _strFirstName;
	private String _strLastName;
	private String _strAge;

	public CustomDataObject(String strFirstName, String strLastName, String strAge)
	{
		_strFirstName = strFirstName;
		_strLastName = strLastName;
		_strAge = strAge;
	}

	public String FirstName
	{
		get{return _strFirstName;}
		set{_strFirstName = value;}
	}

	public String LastName
	{
		get{return _strLastName;}
	}

	public String Age
	{
		get{return _strAge;}
	}

}//end class

</script>
				
The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Modification Type:MajorLast Reviewed:6/14/2002
Keywords:kbDSupport kbEmulation kbprb kbServerControls kbWMLDevice KB312098 kbAudDeveloper