473,473 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

.net table control

Hi all,

I'm trying to add a table row, and cell to the row and also set the colour
of the cell, I seem only able to do this with the pre-defined colours - I
cant for example use #cc66cc ...

tblHeader.Width.Percentage(100%)

Dim Row As New TableRow
Dim Cell As New TableCell

Cell.Text = "<img src=""../Images/Misc/invis.gif"" width=""10""
height=""10"" border=""0"">"
Cell.BackColor = Cell.BackColor.DarkKhaki()
Cell.Width.Percentage(100%)

tblHeader.Rows.Add(Row)
Row.Cells.Add(Cell)

In addition - I also seem unable to set any of the properties for the table
itself, the width 100% at the top here for example doesn't do what I
expected...

In normal HTML if I set a table to 100% and then had one row with one cell,
the cell would also be 100% - this isn't happening :(

Any info would be appreciated, I've search google for a bit and tried the
help within Visual Studio but no joy thus far...the only examples I can find
seem to be on how to add the rows and cells, not how to change their display
settings etc..

Regards

Rob
Nov 18 '05 #1
2 1959
Rob,

You can use the System.Drawing.ColorTranslator class to create a Color
instance from an HTML color string. e.g.:

Cell.BackColor = ColorTranslator.FromHtml("#cc66cc")
To set the width of the cell or table to a percentage value, use the
Percentage method of the System.Web.UI.WebControls.Unit structure. e.g.:

tblHeader.Width = Unit.Percentage(100)

HTH,
Nicole
"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in message
news:MD*********************@news-text.cableinet.net...
Hi all,

I'm trying to add a table row, and cell to the row and also set the colour
of the cell, I seem only able to do this with the pre-defined colours - I
cant for example use #cc66cc ...

tblHeader.Width.Percentage(100%)

Dim Row As New TableRow
Dim Cell As New TableCell

Cell.Text = "<img src=""../Images/Misc/invis.gif"" width=""10""
height=""10"" border=""0"">"
Cell.BackColor = Cell.BackColor.DarkKhaki()
Cell.Width.Percentage(100%)

tblHeader.Rows.Add(Row)
Row.Cells.Add(Cell)

In addition - I also seem unable to set any of the properties for the
table
itself, the width 100% at the top here for example doesn't do what I
expected...

In normal HTML if I set a table to 100% and then had one row with one
cell,
the cell would also be 100% - this isn't happening :(

Any info would be appreciated, I've search google for a bit and tried the
help within Visual Studio but no joy thus far...the only examples I can
find
seem to be on how to add the rows and cells, not how to change their
display
settings etc..

Regards

Rob

Nov 18 '05 #2
"Nicole Calinoiu" wrote ...
You can use the System.Drawing.ColorTranslator class to create a Color
instance from an HTML color string. e.g.:

Cell.BackColor = ColorTranslator.FromHtml("#cc66cc")
To set the width of the cell or table to a percentage value, use the
Percentage method of the System.Web.UI.WebControls.Unit structure. e.g.:

tblHeader.Width = Unit.Percentage(100)


Hi Nicole,

Many thanks for your informative reply - these have indeed solve my
troubles...thank you :o)

Rob
Nov 18 '05 #3

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

Similar topics

8
by: John Smith Jr. | last post by:
I am looking for some way to persist a table web control so when page_load event comes up, i can display the table as it was. I tried using ViewState with the rows collection but that didn't work...
3
by: Marty McDonald | last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate a DataTable whose data should appear in the asp:Table. I created my own code to populate the asp:Table with the...
7
by: klynn | last post by:
I'm wondering what the best way to do the following: I have a page with a table. I built a custom class that creates a System.Web.UI.WebControls table object and return it to the webpage as a...
7
by: david | last post by:
I have asked this question before. But it does not work for me. Given radion buttons in the web form design page. What I did is described as follows. A panel control is dragged into the design...
2
by: clickon | last post by:
I am confused about the way in which asp:table objects work. When a control is within an asp table it generally appears to be in the scope of the tables parent control. E.g. if i have a page that...
4
by: Guy Noir | last post by:
So, I have a table that I only want to appear after some event has fired. Using the asp:table control and the Visible property, this is a piece of cake. The problem is that when I try and drop a...
4
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc.,...
6
by: Jeff | last post by:
....still new to visual studio 2005 and vb.net I have a master page with a content placeholder. The content page has a table in the content placeholder (placed there via dragging from the...
2
by: Geary | last post by:
I am porting my first traditional app to a web-based app using VS2005 and ASP.NET 2.0. I have a page that will replace a data entry form. To have complete control of layout, I want to use a table...
4
by: TS | last post by:
I am losing my colgroup html element of a table that i toggle back and forth of being visible=true/false. is there any workaround since the rendered html doesn't contain it even though it has not...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.