|
-
Aug 5th, 2004, 12:53 AM
#1
Displaying data... that simple a question
There may be something fundamentally wrong with the way I'm thinking.
I have a dataset, with a couple columns, and a few rows. Now, if I wanted to make an editable form for this (one textbox for each column in each row, thus creating a lot of textboxes), how would I go about doing this?
From the current mindset I have, which is very ASP 3.0 based, I'd so something like this:
VB Code:
'Code behind:
Response.Write("<table border=1><tr>")
For intColCount = 0 To ds.Tables(0).Columns.Count - 1
Response.Write("<td><b>" & ds.Tables(0).Columns(intColCount).ToString & "</b></td>")
Next
Response.Write("</tr>")
For intCount = 0 To ds.Tables(0).Rows.Count - 1
Response.Write("<tr>")
For intCount2 = 0 To ds.Tables(0).Columns.Count - 1
Response.Write("<td>" & ds.Tables(0).Rows(intCount).Item(intCount2).ToString & "</td>")
Next
Response.Write("</tr>")
Next
Response.Write("</table>")
You can see what I'm doing here, and for editable textboxes, I'd just replace the appropriate <td>s, etc, etc, etc.
But a few questions arise:
1) Is this the right way at all?
2) What if I wished to have the output of this above code in the middle of some page where other elements already exist? Would I place this code inline to the ASPX page contents, or is that wrong?
Enlighten me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|