944,135 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 12330
  • ASP.NET RSS
Apr 28th, 2007
0

Generate Html from VB.net

Expand Post »
Gidday I have a single Array of items (total number of items in array would be variable) that i want to display in a table like format i.e.
html Syntax (Toggle Plain Text)
  1. <table>
  2. <tr>
  3. <td>ArrayVar[0]</td>
  4. <td>ArrayVar[1]</</td>
  5. </tr>
  6. <tr>
  7. <td>ArrayVar[2]</</td>
  8. <td>ArrayVar[3]</</td>
etc...
or
html Syntax (Toggle Plain Text)
  1. <div style="float:left">ArrayVar[0]</div>
  2. <div style="float:left">ArrayVar[1]</div>
etc...
How can I generate this in VB.net with say a loop I know there was something in .NET 1.1 that could do this & can't find anything for 2.0
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stumaca is offline Offline
1 posts
since Apr 2007
Apr 28th, 2007
-1

Re: Generate Html from VB.net

Stumaca,

www.asp.net

Check out their tutorials, I'm sure you'll be able to figure it out from there. Their tutorials are excellent for someone starting with ASP.

Jon
Reputation Points: 15
Solved Threads: 9
Junior Poster
cutepinkbunnies is offline Offline
143 posts
since Apr 2006
May 2nd, 2007
0

Re: Generate Html from VB.net

use a string builder if you want to make it yourself.

ASP.NET Syntax (Toggle Plain Text)
  1. stringbuilder sb = new stringbuilder;
  2. sb.appendline("<table>");
  3. for (int i=0; i<=arraycount; i+=2) //for vb people it is For I = 0 to arraycount Step 2)
  4. {
  5. sb.appendline("<tr>");
  6. sb.append("<td>");
  7. sb.append(arrayvar[i]);
  8. sb.appendline("</td>");
  9. sb.append("<td>");
  10. sb.append(arrayvar[i+1]);
  11. sb.appendline("</td>");
  12. sb.appendline("</tr>");
  13. }
  14. sb.appendline("</table>");
  15. //now put it on the page - probably using a literal
  16. literal1.text = sb.tostring();

or you could use an html writer but this works just as well.
Reputation Points: 26
Solved Threads: 11
Posting Whiz in Training
f1 fan is offline Offline
275 posts
since Jan 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: update but not updated
Next Thread in ASP.NET Forum Timeline: delete data, then shift its number....





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC