web 2.0

ASP.NET(vb.net) & HTMLTableCell

ASP.NET(vb.net) & HTMLTableCellCell - HTMLTableCell : Creates a server-side control that maps to the <td> and <th> HTML elements and allows you manipulate a cell in a table.

ShotDev Focus:
- ASP.NET(vb.net) & HTMLTableCellCell

ASP.NET(vb.net) & HTMLTableCellCell

Tag Control :

  1. <td or th id="programmaticID"  
  2. align="alignmentofcontentincell"  
  3. bgcolor="bgcolor"  
  4. bordercolor="bordercolor"  
  5. colspan="#ofcolscellspans"  
  6. height="cellheight"  
  7. nowrap="True | False"  
  8. rowspan="#ofrowscellspans"  
  9. valign="vertalignmentofcellcontent"  
  10. width="cellwidth">  
  11. CellContent  
  12. </td or /th>  

Example

HTMLTableCell.aspx

  1. <%@ Page Language="VB" %>  
  2. <script runat="server">  
  3.   
  4. Sub Button1_OnClick(sender As Object, e As EventArgs)  
  5. Dim numrows As Integer  
  6. Dim numcells As Integer  
  7. Dim i As Integer = 0  
  8. Dim j As Integer = 0  
  9. Dim Row As Integer = 0  
  10. Dim r As HtmlTableRow  
  11. Dim c As HtmlTableCell  
  12.   
  13. ' Generate rows and cells  
  14. numrows = CInt(Select1.Value)  
  15. numcells = CInt(Select2.Value)  
  16.   
  17. For j = 0 To numrows-1  
  18.   
  19. r = new HtmlTableRow()  
  20.   
  21. If (row Mod 2 <> 0) Then  
  22. r.BgColor = "Gainsboro"  
  23. End If  
  24. row += 1  
  25.   
  26. For i = 0 To numcells-1  
  27. c = new HtmlTableCell()  
  28. c.Controls.Add(new LiteralControl("row " & j & ", cell " & i))  
  29. r.Cells.Add(c)  
  30. Next i  
  31.   
  32. Table1.Rows.Add(r)  
  33. Next j  
  34.   
  35. End Sub  
  36.   
  37. </script>  
  38. <html>  
  39. <head>  
  40. <title>ShotDev.Com Tutorial</title>  
  41. </head>  
  42. <body>  
  43. <form runat="server">  
  44. Table rows:  
  45. <select id="Select1" runat="server">  
  46. <option Value="1">1</option>  
  47. <option Value="2">2</option>  
  48. <option Value="3">3</option>  
  49. <option Value="4">4</option>  
  50. <option Value="5">5</option>  
  51. </select>  
  52. Table cells:  
  53. <select id="Select2" runat="server">  
  54. <option Value="1">1</option>  
  55. <option Value="2">2</option>  
  56. <option Value="3">3</option>  
  57. <option Value="4">4</option>  
  58. <option Value="5">5</option>  
  59. </select>  
  60. <input id="Button1" type="button" OnServerClick="Button1_OnClick" value="Button" runat="server" />  
  61. <hr />  
  62. <table id="Table1" CellPadding="5" CellSpacing="0" Border="1" runat="server" />  
  63. </form>  
  64. </body>  
  65. </html>  

Screenshot

ASP.NET(vb.net) & HTMLTableCellCell
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.