views:

225

answers:

3

Is there a feature compatible alternative to the asp:ListView control that came with ASP.NET 3.5? Due to some recent issues with a certain hosting provider's installation of SP1, I'm looking for a temporary stand in for the ListView that can be dropped into place with minimal change to the rest of my code.

One simple alternative would be to use a Repeater. Are there any major gotchas in downgrading from a ListView to a Repeater that I need to be aware of?

A: 

You can use repeater control for that there will not be so many gotchas

jalpesh
+3  A: 

You'll lose 2 things:

  1. The templating ListViews provide. You'll have to use HeaderTemplate, ItemTemplate, FooterTemplate layout of the repeater, which is kinda ugly.
  2. Repeaters, once bound, forget the data that was bound to them. If you use the listview's DataKeyNames, that's kind of a big one. Parsing a repeater's items is less than fun.

You can work around both of these, so it's not a huge deal but still worth considering. The repeater is the best alternative to a ListView though, since the ListView was designed as an upgrade to the Repeater.

Read here for more info: http://www.singingeels.com/Articles/The_ListView_Dominates_The_Repeater.aspx

Mike Robinson
I would personally suggest a DataList over a Repeater, but that's just my personal preference (some detractors would boo at the fact that the DataList wraps everything in a table).
TheTXI
Heh, me included. Semantic code or death!
Mike Robinson
Yeah, the reason I'm not using a DataList in the first place is to avoid the issues a table would bring to the party.
Jeromy Irvine
Actually, have you looked into using the CSS control adapters? http://www.asp.net/cssadapters/ They provide non table based versions of many composite controls, including the DataList: http://www.asp.net/CSSAdapters/DataList.aspx - although this example still uses tables, the full source is available, so you can easily remove these if you don't want them.
Zhaph - Ben Duguid
@Ben - That's a great link. It's probably the way I'd have gone if ListView hadn't been available, making it a non-issue at the time.
Jeromy Irvine
A: 

The host appear to have responded on page two about 30 minutes ago:

We apologize for any inconvenience. We believe this is the result of a recent upgrade to ASP .NET 3.5 SP1. Microsoft has discussed this issue and the resolution. You can find that information here - https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=344296&SiteID=212&wa=wsignin1.0

Zhaph - Ben Duguid
It's a good start, I suppose, but unfortunately they completely missed the point and linked to an unrelated issue. Hopefully they get it right. On the other hand, I guess it means they actually read my support email, since I included a link to that topic in it.
Jeromy Irvine
I suppose I'm grateful then that my host isn't rushing to install SP1, even though I really want them to (I want to use some aspects of EntityFramework that seem to require it), so it's a waiting game for me...
Zhaph - Ben Duguid