I created a Report1 and it code behind added this code after InitializeComponent():
// create and populate an array of Coffee objects
Coffee[] coffees = new Coffee[]
{
new Coffee("Latte", 1),
new Coffee("Mocha", 2),
new Coffee("Dark Roast", 3)
};
// assign the array to the DataSource
this.DataSource = coffees;
and added this class:
public class Coffee
{
private string _name;
private int _id;
public Coffee (string name, int id)
{
_name = name;
_id = id;
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
public int ID
{
get
{
return _id;
}
set
{
_id = value;
}
}
}
I added two textboxes to Report1. One uses the expression =id and the other uses =name. When I add Report1 to a web page using a ReportViewer, it only creates 2 records, both show id = 1, and name = Latte.
// create and populate an array of Coffee objects
Coffee[] coffees = new Coffee[]
{
new Coffee("Latte", 1),
new Coffee("Mocha", 2),
new Coffee("Dark Roast", 3)
};
// assign the array to the DataSource
this.DataSource = coffees;
and added this class:
public class Coffee
{
private string _name;
private int _id;
public Coffee (string name, int id)
{
_name = name;
_id = id;
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
public int ID
{
get
{
return _id;
}
set
{
_id = value;
}
}
}
I added two textboxes to Report1. One uses the expression =id and the other uses =name. When I add Report1 to a web page using a ReportViewer, it only creates 2 records, both show id = 1, and name = Latte.