Reputation: 26952
Is it possible to show empty items in ListView in ASP.NET 4.0 ? For example, there are 2 items in the datasource, but I want to show them + 2 other empty items.
Upvotes: 0
Views: 502
Reputation: 3460
I haven't used ListView in a while, but when I need to add an additional item (blank or static) to a DropDownList that is bound to a data source, I use the "OnDataBound" event of the control. That event fires after the data is bound to the control. From that event, you can manipulate the data that has been added to the control, or add new records. I assume this would also work for a ListView. Feel free to correct me if I am wrong.
Upvotes: 1
Reputation: 26952
As a possible solution I can calculate how many items are in the datasource and add the empty items accordingly. But I don't think it is a good idea.
Upvotes: 0