473,503 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table Question

When I did classic ASP, I could build a table that has two columns above an
image that spanned the two columns, or two rows next to an image that spanned
the two rows. I would populate the table from a Recordset like this:

<CENTER>
<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2 WIDTH=600>
<%
Do While Not RS.EOF
For x = 0 To UBound(arrImage) %>
<TR BGCOLOR="#C0C0C0"><TH ALIGN=RIGHT
WIDTH=200><%=RS("Description1")%></TH><TH COLSPAN=2><%=RS("ItemNumber")%></TH>
<TR ALIGN="center">
<TD COLSPAN="3"><IMG SRC="/images/<%=arrImage(x)%>"></TD>
</TR>
<% RS.MoveNext
Next 'x
Loop 'While Not RS.EOF

How do I do this same thing in ASP.NET using a Repeater or a DataGrid or
whatever control is appropriate? I have a DataSet built to retrieve the
data, I just need help displaying it.

Thx,
--

--
Joe Goeke
Nov 19 '05 #1
2 936
How about this code?

DataGrid1.DataSource = MyDataSet
DataGrid1.DataBind()
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"CanoeGuy" <Ca******@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
When I did classic ASP, I could build a table that has two columns above
an
image that spanned the two columns, or two rows next to an image that
spanned
the two rows. I would populate the table from a Recordset like this:

<CENTER>
<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2 WIDTH=600>
<%
Do While Not RS.EOF
For x = 0 To UBound(arrImage) %>
<TR BGCOLOR="#C0C0C0"><TH ALIGN=RIGHT
WIDTH=200><%=RS("Description1")%></TH><TH
COLSPAN=2><%=RS("ItemNumber")%></TH>
<TR ALIGN="center">
<TD COLSPAN="3"><IMG SRC="/images/<%=arrImage(x)%>"></TD>
</TR>
<% RS.MoveNext
Next 'x
Loop 'While Not RS.EOF

How do I do this same thing in ASP.NET using a Repeater or a DataGrid or
whatever control is appropriate? I have a DataSet built to retrieve the
data, I just need help displaying it.

Thx,
--

--
Joe Goeke

Nov 19 '05 #2
Hi,
why don't you do the same you did with asp? Only because there now is sth.
like asp.net it does not mean that one has to forget everything one knows!
Why don't you use sth like:

Dim myTable As New System.Web.UI.HtmlControls.HtmlTable

Dim myTR As System.Web.UI.HtmlControls.HtmlTableRow
Dim myTD As System.Web.UI.HtmlControls.HtmlTableCell

For Each row As System.Data.DataRow In myDataTable.Rows

myTR = New System.Web.UI.HtmlControls.HtmlTableRow

For Each obj As Object In row.ItemArray

myTD = New System.Web.UI.HtmlControls.HtmlTableCell()
' do what you want with the cell

myTR.Cells.Add(myTD)

Next

myTable.Rows.Add(myTR)

Next

Page.Controls.Add(myTable)

if you want to get fancy, otherwise stick to Steves suggestion!

Regards

Daniel Walzenbach

"CanoeGuy" <Ca******@discussions.microsoft.com> schrieb im Newsbeitrag
news:22**********************************@microsof t.com...
When I did classic ASP, I could build a table that has two columns above
an
image that spanned the two columns, or two rows next to an image that
spanned
the two rows. I would populate the table from a Recordset like this:

<CENTER>
<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2 WIDTH=600>
<%
Do While Not RS.EOF
For x = 0 To UBound(arrImage) %>
<TR BGCOLOR="#C0C0C0"><TH ALIGN=RIGHT
WIDTH=200><%=RS("Description1")%></TH><TH
COLSPAN=2><%=RS("ItemNumber")%></TH>
<TR ALIGN="center">
<TD COLSPAN="3"><IMG SRC="/images/<%=arrImage(x)%>"></TD>
</TR>
<% RS.MoveNext
Next 'x
Loop 'While Not RS.EOF

How do I do this same thing in ASP.NET using a Repeater or a DataGrid or
whatever control is appropriate? I have a DataSet built to retrieve the
data, I just need help displaying it.

Thx,
--

--
Joe Goeke

Nov 19 '05 #3

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

Similar topics

2
1882
by: A. Wiebenga | last post by:
Hi all! I am currently involved in a project in which I am supposed to write a XSLT-transformation sheet for some XML data. I will outline the situation first: I've got one large XML file...
1
2080
by: Eric | last post by:
Hello, I'm sure your all tired of these "alignment" question, but please endure mine. Question. Simple put: What makes a table sit beside another table, as oppose to going down below it. ...
4
10541
by: serge | last post by:
I ran into a table that is used a lot. Well less than 100,000 records. Maybe not a lot of records but i believe this table is used often. The table has 26 fields, 9 indexes but no Primary Key at...
5
3727
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
3
1964
by: CAD Fiend | last post by:
Hello, I have a land development project that has a many-to-many relationship. I have ONE question regarding table structures, and ONE question on how to make a Form with two Subforms, below. ...
6
4813
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
1
3618
by: LurfysMa | last post by:
I am working on an electronic flashcard program. Most of the subjects are simple lists of questions and answers. Those seem to be working. Some of the "subjects" have "categories" of questions. ...
9
1717
by: sck10 | last post by:
Hello, I am building a web form that will be used to gather information for marketing plans. The form will have 15 questions which must be answered. Each question can have large blocks of text....
2
2028
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
2
1352
by: servantofone | last post by:
I'm running Access 2003 on Windows XP. This is more of a developmental/implementation type of question. I have a form which requires answers to 35 different questions. All questions are answered...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
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...
0
7460
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...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
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...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
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 ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
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...

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.