Return all objects as string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In ASP.NET, I'm trying to create an email that lists all the products ordered
in a "cart."

I'm not sure how to go about this. Do I create a method in my object file?
Or do I create the string in an ASPX page?

Thanks for any direction!
 
Eacollie,

Whatever way you choise you have to translate it to a String. When you don't
have to store it, than I would go direct for a String.

I hope this helps,

Cor
 
Hi eacollie,

Not quite sure what you want, if your cart contains some kind of object base you can override ToString to reflect the name of the product. You can then simply call ToString on your object to get the name, or it will be done
automatically if you put it in a ListBox or similar.

class MyClass
{
private string Name;
private int ID;

public override string ToString()
{
return "( " + ID + " ) " + Name;
}
}
 
Back
Top