Best way to display data.

  • Thread starter Thread starter RB
  • Start date Start date
R

RB

Hi there,

I'm pretty new to ASP.NET, and have a "best practice" sort-of question.
I'm programming for .NET 2.0, using VB.Net in Visual Studio 2002.

Basically, I've got a web-page which is designed to show data about
Tenants. It consists of a form showing 6 "boxes" of data, each relating
to an aspect of the tenancy (Client, Rent, Landlord, etc). Each box
contains 'n' pieces of information.

This information is currently displayed using a DataGrid, even though
the SQL data-source is returning only 1 row (as we are only looking at 1
tenancy at a time).

To my eyes, the code is too verbose and ugly (not helped by a HTML Table
-based implementation, but that's another story ;-)), and I was
wondering if there was a better way to write a page that would show 1
row of data, or if a DataGrid was actually the way to go about it.

Many thanks,

RB.
 
Since you're only displaying one row of data, there is no need to use any
kind of Control that repeats on a per-row basis.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Kevin said:
Since you're only displaying one row of data, there is no need to use any
kind of Control that repeats on a per-row basis.
Hi Kevin,

That's exactly what I was thinking!!

What would you suggest would be the best way to bind the data.

I could implemenent it as a load of asp:Label's, with the values set
manually in the code-behind, but I was wondering if there was a sexy
ASP.NET way of doing things which is more recommended?

Many thanks,

RB.
 
There are several Controls in ASP.Net that can be data-bound, but they are
designed for multiple records. If you're only displaying a single record, it
might be just as easy to wire your Labels and so on yourself. The only
possible data-bound Control that you could use for such a task is the
System.Web.UI.WebControls.DetailView, which is designed to display a single
record, but is designed to work in the context of multiple records, and is a
Templated Control with a lot of overhead to make it fit into various
scenarios.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Kevin said:
There are several Controls in ASP.Net that can be data-bound, but they are
designed for multiple records. If you're only displaying a single record, it
might be just as easy to wire your Labels and so on yourself. The only
possible data-bound Control that you could use for such a task is the
System.Web.UI.WebControls.DetailView, which is designed to display a single
record, but is designed to work in the context of multiple records, and is a
Templated Control with a lot of overhead to make it fit into various
scenarios.

Thanks Kevin,

That's answered my question perfectly, and given me a couple of things
to go and research.

Many thanks,

RB.
 
Back
Top