473,587 Members | 2,637 Online
Bytes | Software Development & Data Engineering Community
+ 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.Perc entage(100%)

tblHeader.Rows. Add(Row)
Row.Cells.Add(C ell)

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 1967
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("#cc6 6cc")
To set the width of the cell or table to a percentage value, use the
Percentage method of the System.Web.UI.W ebControls.Unit structure. e.g.:

tblHeader.Width = Unit.Percentage (100)

HTH,
Nicole
"Rob Meade" <ro********@N O-SPAM.kingswoodw eb.net> wrote in message
news:MD******** *************@n ews-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.Perc entage(100%)

tblHeader.Rows. Add(Row)
Row.Cells.Add(C ell)

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("#cc6 6cc")
To set the width of the cell or table to a percentage value, use the
Percentage method of the System.Web.UI.W ebControls.Unit structure. e.g.:

tblHeader.Width = Unit.Percentage (100)


Hi Nicole,

Many thanks for your informative reply - these have indeed solve my
troubles...than k 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
1817
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 to well as I got an error trying to put rows collection in the viewstate. My problem is this: I load a table with rows and controls, then wire events, this is after clearing the rows of the table initially in this function.
3
12003
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 DataTable, then I discovered the asp:Table has a DataBind method. But the method takes no args and so I'm confused how to use it. Is there a link to see how DataBind works for asp:Table? Should I just use my own code anyway? Thanks... Here's my...
7
1449
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 property. But its not reading the table correctly. It doesnt see the tablerows and tablecell objects. First, I'm not sure why its not reading the table properly? Second, I wonder if there's a better way to do this? Maybe a custom control? I haven't...
7
4857
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 form, and a table control is dragged into the panel from tooolbox. Add cells for the table through the properties. Now I cut a radio button, and click the table (note I can not select a cell), then right click Paste. The button is not in expected...
2
2372
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 consists of an asp table called MyTable containing a textbox control call MyTextBox then i can access MyTextBox directly from the PageLoad event handler without having to use MyTable.FindControl(MyTextBox). MyTextBox can also be used for a...
4
2827
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 label control or any other asp:control to the table, the designer view gives me the old circle and slash saying "Nope, can't do that". Am I correct to assume then that one cannot place an asp:control in an asp:cell? If I am wrong here, other...
4
2730
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., when you select the cust id. Found this cited as a good method: http://www.mvps.org/access/forms/frm0058.htm I have two tables (clients, assignments) and one form (assignment input) in the database. I have a control box called CUST ID in the...
6
1334
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 toolbox). In the content page I created - using code - a few rows within the table and a few cells within the rows and some text within the cells.
2
2395
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 as a layout device. Typically I would go with a std html table. With VS2005 I have a choice of a html table control or the web table control. I understand the jus of differences between the two, but I am still unsure whether using the html...
4
3207
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 been explicitely been made invisible? note also that even when the table is made visible=true, colgroup still doesn't show up
0
7857
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8220
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8352
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8222
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6632
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5723
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2367
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 we have to send another system
1
1457
muto222
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.