By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,786 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,786 IT Pros & Developers. It's quick & easy.

Best way to display data.

P: n/a
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.
Sep 5 '07 #1
Share this Question
Share on Google+
4 Replies

P: n/a
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

"RB" <ow************@mailinator.comwrote in message
news:Vo******************************@eclipse.net. uk...
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.

Sep 5 '07 #2

P: n/a
RB
Kevin Spencer wrote:
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.
Sep 5 '07 #3

P: n/a
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

"RB" <ow************@mailinator.comwrote in message
news:wb******************************@eclipse.net. uk...
Kevin Spencer wrote:
>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.

Sep 6 '07 #4

P: n/a
RB
Kevin Spencer wrote:
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.
Sep 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.