Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ObjectList - see first element in object?

Status
Not open for further replies.

MarkatTekTips2004

Programmer
Jan 12, 2005
15
0
0
US
I'm using the mobile control "ObjectList" for displaying email messages. I'm forming an ArrayList containing objects having four attributes: to, from, subject, and body.

I'm binding the ObjectList to the ArrayList. This works, but the problem is the lines show up blank in the WAP browser. I'd like to see the "subject" in each line.

How do I control what is displayed in an ObjectList when binding to an ArrayList which contains objects and not simple strings?

Thanks for any assistance!

Mark
 
In the objects contained in your ArrayList, try overriding the ToString method. It's often called when the framework wants to display something.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
tried overriding ToString(). This did not work. I tried in the class of objects being inserted into the ArrayList. I tried in the code-behind where the ObjectList mobile web control exists, none worked.
 
Not sure if this will help, but here goes!

Here's the code in the aspx page containing the ObjectList mobile web control:

***************************

private void frmCheckEmail_Activate(object sender, System.EventArgs e)
{
ArrayList newmsgs = new ArrayList();

Pop myPop = new Pop();

myPop.popConnect();

int numMsgs = myPop.GetNumberOfNewMessages();

if (numMsgs >= 0)
{
if (numMsgs > 0)
{
newmsgs = myPop.GetNewMessages("");
IEnumerator msgenum = newmsgs.GetEnumerator();

while (msgenum.MoveNext() )
{
Message req = (Message)msgenum.Current;
}

this.ObjectList1.DataSource = newmsgs;
this.ObjectList1.DataBind();
}
this.labNumMessages.Text = "Messages: "+numMsgs;
}
else
this.labNumMessages.Text = "Cannot connect to mail server.";

myPop.popDisconnect();
}

***************************

GetNewMessages simply returns an Arraylist of these objects:

public Message(string _to, string _from, string _subject, string _body){
to = _to;
from = _from;
body = _body;
subject = _subject;
}
***************************

On the phone and on the Openwave WAP browser, the list of messages comes up all numbered, but each line is blank other than the number. I can read the message by choosing the line number on the phone. The problem is that I cannot see the subject or anything else in each line prior to choosing that message number and that item being displayed.

Let me know if you need anything further.

Thanks for any assistance,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top