|
 |
aspx_beginners thread: Setting tablecell width programmatically
Message #1 by "Hugh McLaughlin" <hugh@k...> on Wed, 8 Jan 2003 04:44:04
|
|
Hello everyone and thnaks for your help in advance. I am working on an
application that adds table rows and cells programmatically, i.e.
dim myCell as New TableCell()
My question is, how do you set the width for the cell ( and height for
that matter). I can't seem to find any documentation on this. Any help
would be greatly appreciated. Thanks.
Message #2 by "Patrick Casbar" <pcasbar@h...> on Wed, 8 Jan 2003 08:00:08 -0500
|
|
Check out CellSpacing of the Table Class. It appears that CellSpacing
is applied horizontally and vertically to individual cells - it is the
distance in pixels between the border of the cell and the contents of
the cell in the Table control.
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Tuesday, January 07, 2003 11:44 PM
To: aspx_beginners
Subject: [aspx_beginners] Setting tablecell width programmatically
Hello everyone and thnaks for your help in advance. I am working on an
application that adds table rows and cells programmatically, i.e.
dim myCell as New TableCell()
My question is, how do you set the width for the cell ( and height for
that matter). I can't seem to find any documentation on this. Any help
would be greatly appreciated. Thanks.
Message #3 by "M K" <mk_mkel@h...> on Wed, 08 Jan 2003 13:59:55 +0000
|
|
i'm not sure what u want but try this code:
<TABLE language="vb" id="Table1" style="Z-INDEX: 101; LEFT: 22px; WIDTH: 100x; POSITION: absolute; TOP: 100px; HEIGHT: 27px"
cellSpacing="1" cellPadding="1" rules="all" width="450" align="center" border="1"><TR><TD align="middle" width=100x
height=50x><font color="#104a7b">Information</font></TD><TD align="middle" width=150x height=50x><font
color="#104a7b">Information</font></TD><TD align="middle" width=200x height=50x><font
color="#104a7b">Information</font></TD></TABLE>
<TABLE language="vb" id="Table2" style="Z-INDEX: 101; LEFT: 22px; WIDTH: 100x; POSITION: absolute; TOP: 200px; HEIGHT: 27px"
cellSpacing="1" cellPadding="1" rules="all" width="700" align="center" border="1"><TD align="middle" width=150x
height=100x><font color="#104a7b">Information</font></TD><TD align="middle" width=250x
height=100x><font color="#104a7b">Information</font></TD><TD align="middle" width=300x
height=100x><font color="#104a7b">Information</font></TD></TABLE>
>From: "Patrick Casbar"
>Reply-To: "aspx_beginners"
>To: "aspx_beginners"
>Subject: [aspx_beginners] RE: Setting tablecell width programmatically
>Date: Wed, 8 Jan 2003 08:00:08 -0500
>
>Check out CellSpacing of the Table Class. It appears that CellSpacing
>is applied horizontally and vertically to individual cells - it is the
>distance in pixels between the border of the cell and the contents of
>the cell in the Table control.
>
>-----Original Message-----
>From: Hugh McLaughlin [mailto:hugh@k...]
>Sent: Tuesday, January 07, 2003 11:44 PM
>To: aspx_beginners
>Subject: [aspx_beginners] Setting tablecell width programmatically
>
>Hello everyone and thnaks for your help in advance. I am working on an
>application that adds table rows and cells programmatically, i.e.
>
>dim myCell as New TableCell()
>
>My question is, how do you set the width for the cell ( and height for
>that matter). I can't seem to find any documentation on this. Any help
>
>would be greatly appreciated. Thanks.
>---
>
>---
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
Message #4 by "Hugh McLaughlin" <hugh@k...> on Wed, 8 Jan 2003 15:14:09
|
|
What I am trying to accomplish is to set the width programmatically, since
the table and cells are generated at run time. Thus:
Dim MyRow As New TableRow
Dim MyTableCell As New TableCell
MyTableCell.Width=400 'This will not work-it is what I am asking
MyRow.Add.Cell(MyTableCell)
The code you showed would be fine at design time, but doesn't fit what I
am doing. The other response deals with cellspacing and padding, but I am
trying to affect the "width" attribute that is generated in the HTML at
runtime.
>
i'm not sure what u want but try this code:
<TABLE language="vb" id="Table1" style="Z-INDEX: 101; LEFT: 22px; WIDTH:
100x; POSITION: absolute; TOP: 100px; HEIGHT: 27px" cellSpacing="1"
cellPadding="1" rules="all" width="450" align="center" border="1"><TR><TD
align="middle" width=100x height=50x><font
color="#104a7b">Information</font></TD><TD align="middle" width=150x
height=50x><font color="#104a7b">Information</font></TD><TD align="middle"
width=200x height=50x><font color="#104a7b">Information</font></TD></TABLE>
<TABLE language="vb" id="Table2" style="Z-INDEX: 101; LEFT: 22px; WIDTH:
100x; POSITION: absolute; TOP: 200px; HEIGHT: 27px" cellSpacing="1"
cellPadding="1" rules="all" width="700" align="center" border="1"><TD
align="middle" width=150x height=100x><font
color="#104a7b">Information</font></TD><TD align="middle" width=250x
height=100x><font color="#104a7b">Information</font></TD><TD
align="middle" width=300x height=100x><font
color="#104a7b">Information</font></TD></TABLE>
>From: "Patrick Casbar"
>Reply-To: "aspx_beginners"
>To: "aspx_beginners"
>Subject: [aspx_beginners] RE: Setting tablecell width programmatically
>Date: Wed, 8 Jan 2003 08:00:08 -0500
>
>Check out CellSpacing of the Table Class. It appears that CellSpacing
>is applied horizontally and vertically to individual cells - it is the
>distance in pixels between the border of the cell and the contents of
>the cell in the Table control.
>
>-----Original Message-----
>From: Hugh McLaughlin [mailto:hugh@k...]
>Sent: Tuesday, January 07, 2003 11:44 PM
>To: aspx_beginners
>Subject: [aspx_beginners] Setting tablecell width programmatically
>
>Hello everyone and thnaks for your help in advance. I am working on an
>application that adds table rows and cells programmatically, i.e.
>
>dim myCell as New TableCell()
>
>My question is, how do you set the width for the cell ( and height for
>that matter). I can't seem to find any documentation on this. Any help
>
>would be greatly appreciated. Thanks.
>---
>
>---
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
Message #5 by "Patrick Casbar" <pcasbar@h...> on Wed, 8 Jan 2003 10:18:26 -0500
|
|
Oh, I think you'll need to include some response.write statements to
create your html tags. Note the width parameter in the table tag below.
Of course, you'll want to substitute a variable for the width value and
concatenate the string and variable to build the tag - so it would look
like: response.write("<table border=3D'1' width=3D'" & varWidth & "'>")
The following code works and shows the size of files in your root dir:
<%@ Page Language=3D"VB" debug=3D"true" %>
<%@ Import Namespace=3D"System.IO" %>
<%
Dim item as string
Dim items() as String
Dim DirName as String
Dim dir as DirectoryInfo
Dim f as FileInfo
=09
DirName =3D "C:\"
dir =3D New DirectoryInfo(DirName)
=09
'Get all files & directories in C:\ and enumerate them
items =3D directory.getfilesystementries("c:\")
'for each item in items
' response.write(item & "<br \>")
'next
=09
response.write("<table border=3D'1' width=3D'600'>")
response.write("<tr bgcolor=3Dcornflowerblue>")
response.write("<td>File</td>")
response.write("<td>Size</td>")
response.write("</tr>")
=09
for each f in dir.getfiles()
Response.write("<tr>")
response.write("<td>" & f.name) =09
response.write(" ")
response.write("<td>" & f.length.tostring() & "</td>")
response.write("<br \>")
=09
next
=09
response.write("</table>")
=09
%>
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Wednesday, January 08, 2003 10:14 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Setting tablecell width programmatically
What I am trying to accomplish is to set the width programmatically,
since
the table and cells are generated at run time. Thus:
Dim MyRow As New TableRow
Dim MyTableCell As New TableCell
MyTableCell.Width=3D400 'This will not work-it is what I am asking
MyRow.Add.Cell(MyTableCell)
The code you showed would be fine at design time, but doesn't fit what I
am doing. The other response deals with cellspacing and padding, but I
am
trying to affect the "width" attribute that is generated in the HTML at
runtime.
>
i'm not sure what u want but try this code:
<TABLE language=3D"vb" id=3D"Table1" style=3D"Z-INDEX: 101; LEFT: 22px;
WIDTH:
100x; POSITION: absolute; TOP: 100px; HEIGHT: 27px" cellSpacing=3D"1"
cellPadding=3D"1" rules=3D"all" width=3D"450" align=3D"center"
border=3D"1"><TR><TD
align=3D"middle" width=3D100x height=3D50x><font
color=3D"#104a7b">Information</font></TD><TD align=3D"middle"
width=3D150x
height=3D50x><font color=3D"#104a7b">Information</font></TD><TD
align=3D"middle"
width=3D200x height=3D50x><font
color=3D"#104a7b">Information</font></TD></TABLE>
<TABLE language=3D"vb" id=3D"Table2" style=3D"Z-INDEX: 101; LEFT: 22px;
WIDTH:
100x; POSITION: absolute; TOP: 200px; HEIGHT: 27px" cellSpacing=3D"1"
cellPadding=3D"1" rules=3D"all" width=3D"700" align=3D"center"
border=3D"1"><TD
align=3D"middle" width=3D150x height=3D100x><font
color=3D"#104a7b">Information</font></TD><TD align=3D"middle"
width=3D250x
height=3D100x><font color=3D"#104a7b">Information</font></TD><TD
align=3D"middle" width=3D300x height=3D100x><font
color=3D"#104a7b">Information</font></TD></TABLE>
=A0
=A0
=A0
>From: "Patrick Casbar"
>Reply-To: "aspx_beginners"
>To: "aspx_beginners"
>Subject: [aspx_beginners] RE: Setting tablecell width programmatically
>Date: Wed, 8 Jan 2003 08:00:08 -0500
>
>Check out CellSpacing of the Table Class. It appears that CellSpacing
>is applied horizontally and vertically to individual cells - it is the
>distance in pixels between the border of the cell and the contents of
>the cell in the Table control.
>
>-----Original Message-----
>From: Hugh McLaughlin [mailto:hugh@k...]
>Sent: Tuesday, January 07, 2003 11:44 PM
>To: aspx_beginners
>Subject: [aspx_beginners] Setting tablecell width programmatically
>
>Hello everyone and thnaks for your help in advance. I am working on an
>application that adds table rows and cells programmatically, i.e.
>
>dim myCell as New TableCell()
>
>My question is, how do you set the width for the cell ( and height for
>that matter). I can't seem to find any documentation on this. Any help
>
>would be greatly appreciated. Thanks.
>
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
Message #6 by "Alex Smotritsky" <alex.smotritsky@v...> on Wed, 8 Jan 2003 10:48:57 -0500
|
|
The problem with that is that it's the classical asp way of doing it,
there has to be a .net way of doing it that doesn't mix presentation
with logic.
-----Original Message-----
From: Patrick Casbar [mailto:pcasbar@h...]
Sent: Wednesday, January 08, 2003 10:18 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Setting tablecell width programmatically
Oh, I think you'll need to include some response.write statements to
create your html tags. Note the width parameter in the table tag below.
Of course, you'll want to substitute a variable for the width value and
concatenate the string and variable to build the tag - so it would look
like: response.write("<table border=3D'1' width=3D'" & varWidth & "'>")
The following code works and shows the size of files in your root dir:
<%@ Page Language=3D"VB" debug=3D"true" %>
<%@ Import Namespace=3D"System.IO" %>
<%
Dim item as string
Dim items() as String
Dim DirName as String
Dim dir as DirectoryInfo
Dim f as FileInfo
=09
DirName =3D "C:\"
dir =3D New DirectoryInfo(DirName)
=09
'Get all files & directories in C:\ and enumerate them
items =3D directory.getfilesystementries("c:\")
'for each item in items
' response.write(item & "<br \>")
'next
=09
response.write("<table border=3D'1' width=3D'600'>")
response.write("<tr bgcolor=3Dcornflowerblue>")
response.write("<td>File</td>")
response.write("<td>Size</td>")
response.write("</tr>")
=09
for each f in dir.getfiles()
Response.write("<tr>")
response.write("<td>" & f.name) =09
response.write(" ")
response.write("<td>" & f.length.tostring() & "</td>")
response.write("<br \>")
=09
next
=09
response.write("</table>")
=09
%>
-----Original Message-----
From: Hugh McLaughlin [mailto:hugh@k...]
Sent: Wednesday, January 08, 2003 10:14 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Setting tablecell width programmatically
What I am trying to accomplish is to set the width programmatically,
since
the table and cells are generated at run time. Thus:
Dim MyRow As New TableRow
Dim MyTableCell As New TableCell
MyTableCell.Width=3D400 'This will not work-it is what I am asking
MyRow.Add.Cell(MyTableCell)
The code you showed would be fine at design time, but doesn't fit what I
am doing. The other response deals with cellspacing and padding, but I
am
trying to affect the "width" attribute that is generated in the HTML at
runtime.
>
i'm not sure what u want but try this code:
<TABLE language=3D"vb" id=3D"Table1" style=3D"Z-INDEX: 101; LEFT: 22px;
WIDTH:
100x; POSITION: absolute; TOP: 100px; HEIGHT: 27px" cellSpacing=3D"1"
cellPadding=3D"1" rules=3D"all" width=3D"450" align=3D"center"
border=3D"1"><TR><TD
align=3D"middle" width=3D100x height=3D50x><font
color=3D"#104a7b">Information</font></TD><TD align=3D"middle"
width=3D150x
height=3D50x><font color=3D"#104a7b">Information</font></TD><TD
align=3D"middle"
width=3D200x height=3D50x><font
color=3D"#104a7b">Information</font></TD></TABLE>
<TABLE language=3D"vb" id=3D"Table2" style=3D"Z-INDEX: 101; LEFT: 22px;
WIDTH:
100x; POSITION: absolute; TOP: 200px; HEIGHT: 27px" cellSpacing=3D"1"
cellPadding=3D"1" rules=3D"all" width=3D"700" align=3D"center"
border=3D"1"><TD
align=3D"middle" width=3D150x height=3D100x><font
color=3D"#104a7b">Information</font></TD><TD align=3D"middle"
width=3D250x
height=3D100x><font color=3D"#104a7b">Information</font></TD><TD
align=3D"middle" width=3D300x height=3D100x><font
color=3D"#104a7b">Information</font></TD></TABLE>
=A0
=A0
=A0
>From: "Patrick Casbar"
>Reply-To: "aspx_beginners"
>To: "aspx_beginners"
>Subject: [aspx_beginners] RE: Setting tablecell width programmatically
>Date: Wed, 8 Jan 2003 08:00:08 -0500
>
>Check out CellSpacing of the Table Class. It appears that CellSpacing
>is applied horizontally and vertically to individual cells - it is the
>distance in pixels between the border of the cell and the contents of
>the cell in the Table control.
>
>-----Original Message-----
>From: Hugh McLaughlin [mailto:hugh@k...]
>Sent: Tuesday, January 07, 2003 11:44 PM
>To: aspx_beginners
>Subject: [aspx_beginners] Setting tablecell width programmatically
>
>Hello everyone and thnaks for your help in advance. I am working on an
>application that adds table rows and cells programmatically, i.e.
>
>dim myCell as New TableCell()
>
>My question is, how do you set the width for the cell ( and height for
>that matter). I can't seem to find any documentation on this. Any help
>
>would be greatly appreciated. Thanks.
>
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE*
|
|
 |