473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to set Backcolor in cells of Dynamically Created Tables in ASP.NET

144 100+
Hai Friends,

I have the following code for Dynamically Created Tables, I have created the panel in the webform.......

Dim tab5 As New Table
Dim row1 As New TableRow

Dim cell1 As New TableCell
cell1.Text = "Java"
row1.Cells.Add(cell1)


Dim cell2 As New TableCell
cell2.Text = "C++"
row1.Cells.Add(cell2)

tab5.Rows.Add(row1)
panel1.Controls.Add(tab5)

it works properly , But the Proplem is i cant give backcolor for Cell in this format #FFFFFFF,#66CCFF etc

when i give like this

cell2.Backcolor="#FFFFFFF"

it shows as Error....

I have to give color in this Format #FFFFFFF,#66CCFF etc

Pl Help Me

Thanks in Advance...................

Posted Date :- 29 Feb 2008

Davidson
Feb 28 '08 #1
5 2962
Plater
7,872 Expert 4TB
Those numbers are just the hex version of your color. (Red Green Blue values). Just create a Color object using those values and assign it to the back color.
Feb 28 '08 #2
balabaster
797 Expert 512MB
Those numbers are just the hex version of your color. (Red Green Blue values). Just create a Color object using those values and assign it to the back color.
Alternatively you could use something akin to:
Expand|Select|Wrap|Line Numbers
  1. MyTable.Row(n).BackColor = System.Drawing.ColorTranslator.FromHtml("#C0C0C0")
Should do the job...
Feb 28 '08 #3
Hi Davidson
Try this out
cell2.BackColor = Drawing.ColorTranslator.FromHtml("#C3E4F9")
Hope this helps

Hai Friends,

I have the following code for Dynamically Created Tables, I have created the panel in the webform.......

Dim tab5 As New Table
Dim row1 As New TableRow

Dim cell1 As New TableCell
cell1.Text = "Java"
row1.Cells.Add(cell1)


Dim cell2 As New TableCell
cell2.Text = "C++"
row1.Cells.Add(cell2)

tab5.Rows.Add(row1)
panel1.Controls.Add(tab5)

it works properly , But the Proplem is i cant give backcolor for Cell in this format #FFFFFFF,#66CCFF etc

when i give like this

cell2.Backcolor="#FFFFFFF"

it shows as Error....

I have to give color in this Format #FFFFFFF,#66CCFF etc

Pl Help Me

Thanks in Advance...................

Posted Date :- 29 Feb 2008

Davidson
Feb 28 '08 #4
Plater
7,872 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. System.Drawing.ColorTranslator.FromHtml()
  2.  
Learn something new everyday.
Feb 28 '08 #5
balabaster
797 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. System.Drawing.ColorTranslator.FromHtml()
  2.  
Learn something new everyday.
;o) Glad to inform...hehe
Feb 28 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Finn Newick | last post by:
By defining a style as follows: @media aural, handheld {td.layout {display:block;}} I'm hoping to linearise layout tables when viewed by screenreaders and handheld devices (it is also be in...
0
by: Chris Powell | last post by:
I am using Excel/Access 2000 and have two large Excel files (25,000 rows each) that I wish to create linked tables in Access rather than importing into Access. The two source Excel files change...
4
by: Rob Meade | last post by:
Hi all, I'm desperately trying to get this to work and I just cant do it - new to ASP.net - probably the reason! I'm using visual studio for this - I have this in the html page : <asp:Table...
5
by: Richard Dixson | last post by:
I created a new C# web application. Basically all I am trying to do is create a table that consists of a few rows with two columns in each. And then to set those columns to text values from my...
1
by: Chris | last post by:
Hi, I am trying to set a row backcolor based on the value of a cell in my datagrid but it's not working This is what I have Private Sub grdProcessingTitles_ItemDataBound(ByVal sender As...
5
by: mrid via DotNetMonster.com | last post by:
hi. im exporting data from a vb form to excel. i am able to create a new excel file, save and edit it without any trouble, but the formatting is giving me hell! i need to be able to show certain...
4
by: Paul | last post by:
Hello All, I have been trying to figure out how to set the BackColor of individual cells in a DataGridView. I found the following solution in a VB usenet group DataGridView1.Item(ColumnIndex,...
4
by: .Net Sports | last post by:
I need to dynamically assign a datalist attribute upon a helper function receiving data from a querystring. If a user picks a certain region, i need the datalist to display its back color, or any...
1
by: Ayushi | last post by:
Hello, I have dynamically created fields in a gridview and bound the grid.But I am not able to access the cells in those fields.Can anybody help me out with this. Thankyou.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.