You create a list of Auctionsobjects within yourself = Stackoverflow .
It's your problem:
public class Auction {
private List<Auction> listaAukcija = new List<Auction>();
}
You will need to separate the model Auctionfrom the service or repository that receives the data.
For example:
public class Auction {
public string Productname { get; set; }
public string Lastbidder { get; set; }
public int Bidvalue { get; set; }
public override string ToString()
{
return base.ToString();
}
}
public class AuctionService {
private List<Auction> listaAukcija = new List<Auction>();
public List<Auction> ListaAukcija
{
get { return listaAukcija; }
set { listaAukcija = value; }
}
public void getAll()
{
}
}
UPDATE
AuctionService DbBroker. DbBroker Home ().
public class DbBroker
{
AuctionService auctionService = new AuctionService();
public void executeQuery()
{
auctionService.getAll();
}
public void getArr()
{
string[] lista = auctionService.ListaAukcija.ConvertAll(obj => obj.ToString()).ToArray();
ListBox1.Text = string.Join("\n", lista);
}
}
_Load() - executeQuery(), .
public partial class Home : System.Web.UI.Page
{
DbBroker dbb = new DbBroker();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Label3.Text = Session["Username"].ToString();
dbb.executeQuery();
dbb.getArr();
}
}
}
PS. AuctionService , DbBroker . .
, .