[Solved] Error adding items to the Grid


GridView1.DataSource = Sabt;
GridView1.DataBind();

Sabt seems to be single object. To bind DataGrid you need to have collection like List<JadvalSabtenam > or BindingList<JadvalSabtenam>

Try that:

List<JadvalSabtenam > dataSource = new List<JadvalSabtenam> {Sabt};
GridView1.DataSource = dataSource;
GridView1.DataBind();

Reason for that is: What Grid should do with single object? When it’s collection each item is corresponding to one row, and each property to column which makes perfect sense.

2

solved Error adding items to the Grid