473,785 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataList, Repeater, or Data Grid?


I am resurrecting an old script from a previous programmer, and want to
migrate it over to asp.net from classic asp. Tho there are other
peripheral parts of the script (that really have no bearing on the
core, in which I will explain), the main core is the concern. I have a
daily feed from a horseracing prognosticator that gets put into an sql
database on a daily basis for roughly 15 popular racetracks. A user
(who will need a usern/password) will come to a page that lists the
tracks available for that day, click on a link for a track, and will
come to the page and script in question. From the database will be data
from 3 different tables: tblRace (the # of race for that day, the
racedate the trackID, other auxiliary info like track length, horse
ages for a race, ), tblTrack (trackname, trackID) , tblHorseentry (the
horses name, the gate position, speed rating, other aux info) .
tblHorseentry has a raceid, relational key with tblRace, and a trackid
is in relation with tblhorseentry and tbltrack. Below is the SQL
statement:
'''sql stmt'''
<% sqlstr ="SELECT
tblhorseentry.h orsename,tblhor seentry.gatepos ,tblhorseentry. bestbet,tblhors eentry.topplay, tblhorseentry.r ating,tblhorsee ntry.speedpr,tb lrace.raceid,tb lrace.racedate, tblrace.raceno, tblrace.racelen gth,tblrace.rac eturf,tblrace.r acedescription, tblrace.horseag e,tbltrack.trac kname
FROM tblrace INNER JOIN tblhorseentry ON tblhorseentry.r aceid =
tblrace.raceid INNER JOIN tbltrack ON tblrace.trackid =
tbltrack.tracki d WHERE trackname = '" &
request.queryst ring("trackname ") & "' and racedate = '" &
request.queryst ring("racedate" ) & "' AND raceno = 1 AND rating = 1;" %>

The problem here is at the end, where along with the querystrings
bringing over the trackname and racedate, this sqlstring will bring up
just the horsesname and auxiliary info for just the first race, and if
he is the favored horse (rating) for this particular race by
information compiled by the horseracing handicapper. I need to find a
way to grab all the racenumbers (raceno) and ratings in an array and
somehow loop thru the array until the end of the recordset (asp) or
dataset (asp.net).

With those obstacle in mind, how can I start to set this up in asp.net.
Will a DataList that just templates everything out, or a Repeater
control be best, or will even a DataGrid control encompass everything I
need to accomplish?

Thanks for any input

E.M.
..Net Sports

Nov 19 '05 #1
1 1680
On 23 Feb 2005, ".Net Sports" <ba********@cox .net> postulated in
news:11******** **************@ f14g2000cwb.goo glegroups.com:
Subject: DataList, Repeater, or Data Grid?
From: ".Net Sports" <ba********@cox .net>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
I am resurrecting an old script from a previous programmer, and want to migrate it over to asp.net from classic asp. Tho there are other
peripheral parts of the script (that really have no bearing on the
core, in which I will explain), the main core is the concern. I have a daily feed from a horseracing prognosticator that gets put into an sql database on a daily basis for roughly 15 popular racetracks. A user
(who will need a usern/password) will come to a page that lists the
tracks available for that day, click on a link for a track, and will come to the page and script in question. From the database will be data from 3 different tables: tblRace (the # of race for that day, the
racedate the trackID, other auxiliary info like track length, horse
ages for a race, ), tblTrack (trackname, trackID) , tblHorseentry (the horses name, the gate position, speed rating, other aux info) .
tblHorseentry has a raceid, relational key with tblRace, and a trackid is in relation with tblhorseentry and tbltrack. Below is the SQL
statement:
'''sql stmt'''
<% sqlstr ="SELECT
tblhorseentry.h orsename,tblhor seentry.gatepos ,tblhorseentry. bestbet ,tblhorseentry. topplay,tblhors eentry.rating,t blhorseentry.sp eedpr,tbl
race.raceid,tbl race.racedate,t blrace.raceno,t blrace.raceleng th,tblrac
e.raceturf,tblr ace.racedescrip tion,tblrace.ho rseage,tbltrack .tracknam
e FROM tblrace INNER JOIN tblhorseentry ON tblhorseentry.r aceid =
tblrace.raceid INNER JOIN tbltrack ON tblrace.trackid =
tbltrack.tracki d WHERE trackname = '" &
request.queryst ring("trackname ") & "' and racedate = '" &
request.queryst ring("racedate" ) & "' AND raceno = 1 AND rating = 1;" %>
The problem here is at the end, where along with the querystrings
bringing over the trackname and racedate, this sqlstring will bring up just the horsesname and auxiliary info for just the first race, and if he is the favored horse (rating) for this particular race by
information compiled by the horseracing handicapper. I need to find a way to grab all the racenumbers (raceno) and ratings in an array and somehow loop thru the array until the end of the recordset (asp) or
dataset (asp.net).

With those obstacle in mind, how can I start to set this up in asp.net. Will a DataList that just templates everything out, or a Repeater
control be best, or will even a DataGrid control encompass everything I need to accomplish?

Thanks for any input

E.M.
.Net Sports


E.M.

All of the data list controls that you mention are webcontrols, that
is, they are user interface controls for displaying the data.

The classes that you shold explore are the ones designed for the
backend data tier, within the Data namespace and are referred to in
general as ADO.NET.

First readup on ADO.net in general. Note that Dot Net is designed for
n-tier design practices, so you must understand the conceptual
paradigm.

Thenm get to know the connection and command objects. These are
SIMILAR to ADO, but not exact. The key to returning data from your
sql statement is through the Command object. Since you are dealing
with lists of records, you'll next need to understand the objects
that model a view in your application.

In ASP, we used an ADORecordset. No such thing in ADO.NET. What we
now use are either a SQLDataReader or a DataAdapter.

Both are similar, but a DataAdapter is a high-end data repository
designed to cache multiple tables in your application. It is actually
a mini database, a kind of front-end processor for SQL Server. While
your description seems to imply that you would benefit from using a
DataAdapter, this may not be entirely true, as a this object is quite
complicated and takes some experience to use efficiently.

A SQLDataReader is most similar to an ASP style disconnected
ADORecordset, so if your model app uses these, then porting to ASP
might be simpler, at least in the first pass, using these. They are
usually sufficient to read data and forward to any of the datalist
type webcontrols you have listed above.

Look at the ASP.NET examples supplied with the SDK and also available
online at: http://samples.gotdotnet.com/quickstart/aspplus/

Make special note of the examples titled: Server-side Data Access and
Data Binding to Server Controls.

good luck

-- ipgrunt
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3303
by: Stephen Miller | last post by:
I am using the OnItemDataBound event of Repeater control to nest a DataGrid within the Repeater. When I attempt to bind to the DataGrid using the DataSource method I get the error message "Object reference not set to an instance of an object". This error message commonly occurs when a server control is incorrecly declared, so naturally I have double checked this. To test this, I moved the aspx code for the DataGrid ('myNestedDataGrid')...
6
1334
by: Thanh | last post by:
I created an ASP.NET project and dropped a DataList on the web form. I then wrote a simple class to return data: namespace Playing { public class PositionData { private string name; private string ticker;
0
1175
by: Shun Duke | last post by:
I have working code allowing me to nest repeaters inside datalists using relations and child rows but this does not allow me to acheive my goal. What I want to be able to do is display small tables (approx 5-10 rows by 3-4 columns) of data using repeaters nested in a datalist. Each row in the datalist source will act as a pointer and filter to the child table for the repeater source.
5
3791
by: Ben Fidge | last post by:
I'm using DataList to present tabular data but am often having problems with some rows column alignment being out of synch with the rest of the rows. My DataList looks similar to this...: <asp:datalist id="DataList1" runat="server"> <HeaderTemplate> <table border="0" cellpadding="0" cellspacing="0" width="400"> <tr> <td width="100">First Name</td>
5
1179
by: serge calderara | last post by:
Dear all, Does this datalist control is somehow similar as a datasource for any other control ? I really to catch the use of it, can we assimilate that control as a kind of dataset or dataprovider ? Similar things with the Repeater control is for defining a kind of section in a set of dta in a grid layout ?
2
1196
by: serge calderara | last post by:
Dear all, I have make some basic testing on Repeater and DataList object. I have notice for sure that if your database retrive data contains 3 records, then both controls will repeat the predifined template to display those 3 records. As a first view I would say that Datalist or Repeater are not so suitable as Datagrid to display a well formed data row...
1
1747
by: Simon Cheng | last post by:
When I tried to display data in datalist and repeater, the first data item always disappears in all datalist and repeaters in my web forms. The code I use for the html page is: <TD id="tdDepartment" runat="server"><asp:datalist id="dlstDept" runat="server" HorizontalAlign="Left" CellPadding="0" Width="100%"> <HeaderTemplate> <p><b>Department Info</b></p> </HeaderTemplate> <ItemTemplate>
1
5087
by: David Lozzi | last post by:
Howdy, I have a datalist which is displaying a list of categories and their associated sub categories in secondary datalists. Works great in a single column. Unfortunaly when i switch it to repeatcolumn = 2 (or three or anything over 1) , the data is displayed quite erratically, for example category 1 category 3 sub 1 sub 1 sub 2
2
11845
by: Paulo | last post by:
What is DetailsView, FormView, DataList, Repeater components? Any differences? VS 2005 asp.net C#
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.