Curtis White
Curtis White

Reputation: 6353

ASP.NET control for displaying single items?

When designing an ASP.NET user control my standard way for creating say a details view would be to create a property of the desired type on my page and would set the property in the page load based on the supplied query parameter.

I feel I'm probably doing more work then necessary. If I could encase my view inside a container then I could merely have it databound and thus make everything declarative.

My question is what would be the lightweight container/controls that would be appropriate for databinding a single object?

As a second question, how can I handle invalid query strings with this method?

Upvotes: 0

Views: 385

Answers (1)

Rippo
Rippo

Reputation: 22424

I use a <asp:literal .../> as this is very lightweight. I usually also add enableviewstate="false"

Upvotes: 2

Related Questions