473,806 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to get started with tables...

I've been attempting to find the answer, but don't know what to search for.
If someone could get me started, I can figure the rest out.

I'm using visual web 2005 with vb.

The following works to change the background color on a table called
"table1"

Table1.BackColo r = Drawing.Color.B lue

I would like to programatically change the background color on a row (or
column or both) within that table.
Could someone point me in the right direction.

Thanks

Jeff
--
Posted via a free Usenet account from http://www.teranews.com

Dec 28 '06 #1
4 1178
Hi Jeff,

I assume you're referring to <asp:Table(Syst em.Web.UI.WebCo ntrols.Table).
Let me know if this is not the case.

You could easily use Table.Rows(inde x) to get a reference to individual row
(of type TableRow). From the TableRow reference, you can use
TableRow.Cells( index) to get a reference to individual cell (of type
TableCell). Both of them also have a property named BackColor which can let
you set their background color.

I've written following code snippet to demonstrate how to change a row or
column's background color:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
' Add some rows/columns to the table
For i As Integer = 1 To 10
Dim tr As New TableRow
For j As Integer = 1 To 10
Dim td As New TableCell
td.Text = i.ToString + "." + j.ToString()
tr.Cells.Add(td )
Next
table1.Rows.Add (tr)
Next
' change third row's background color
table1.Rows(2). BackColor = Drawing.Color.B lue

' change third column's background color
' since the table is row-oriented, we need to set the cell
row-by-row
For i As Integer = 0 To table1.Rows.Cou nt - 1
table1.Rows(i). Cells(2).BackCo lor = Drawing.Color.G ray
Next
End Sub
Hope this helps.
Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 28 '06 #2

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:Xl******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Jeff,

I assume you're referring to <asp:Table>
(System.Web.UI. WebControls.Tab le).
Let me know if this is not the case.
Yes, I am referring to the above and understand your code example. I'm still
new to this, however, and can't figure out one last (small) thing. If I'm
working with a .aspx file in the design view of visual web 2005 with the
code-behind file .aspx.vb and if I create a table using the graphical
interface of the .aspx file by going to the layout insert table menu, and
subsequently give it the ID of "table1," the code below does not work, as
it apparently does not refer to the table I just created with the graphic
interface.

table1.Rows(2). BackColor = Drawing.Color.B lue

if I first declare table1 in the following manner, it still doesn't work
(when placed above the code listed above), but it now does not indicate an
error - when the thing is run, however, nothing happens.

Dim table1 As New Table

I know that this is certainly basic, but I'm not sure I understand how to
properly link the table in the DUI's design view and the vb code in the
codebehind file so that it can be programmaticall y manipulated.

Can you explain further?

Jeff
--
Posted via a free Usenet account from http://www.teranews.com

Dec 28 '06 #3

"Jeff" <no**@none.comw rote in message
news:45******** *************** @free.teranews. com...
>
"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:Xl******** ******@TK2MSFTN GHUB02.phx.gbl. ..
>Hi Jeff,

I assume you're referring to <asp:Table>
(System.Web.UI .WebControls.Ta ble).
Let me know if this is not the case.

Yes, I am referring to the above and understand your code example.

Never mind. I figured it out. ...don't use the layout table from the menu,
use the table from the toolbox.

Thanks.

Jeff

--
Posted via a free Usenet account from http://www.teranews.com

Dec 28 '06 #4
Hi Jeff,

Thanks for the update.

You might want to check out following resources on how to learn ASP.NET:

#INFO: ASP.NET Roadmap
http://support.microsoft.com/kb/305140

#Microsoft ASP.NET QuickStarts Tutorial
http://www.dotnetjunkies.com/quickst...uickstart.aspx

#ASP.NET QuickStart Tutorial
http://quickstarts.asp.net/QuickStar...t/Default.aspx

Please feel free to post in asp.net related newsgroups if you have any
questions when you're learning ASP.NET. You can find all managed newsgroups
list here:

http://msdn2.microsoft.com/en-us/sub.../aa974230.aspx

For ASP.NET related questions, please use following newsgroups:

microsoft.publi c.dotnet.framew ork.aspnet
microsoft.publi c.dotnet.framew ork.aspnet.buil dingcontrols
microsoft.publi c.dotnet.framew ork.aspnet.cach ing
microsoft.publi c.dotnet.framew ork.aspnet.data gridcontrol
microsoft.publi c.dotnet.framew ork.aspnet.mobi le
microsoft.publi c.dotnet.framew ork.aspnet.secu rity
microsoft.publi c.dotnet.framew ork.aspnet.webc ontrols
microsoft.publi c.dotnet.framew ork.aspnet.webs ervices
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Dec 28 '06 #5

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

Similar topics

3
1512
by: EasyRider41 | last post by:
I am trying to merge to scripting samples I for on a source code web site and having limited luck. Then first one is called Zebra Tables witch colors alternate rows of a table to look beter. The second is a rule code that highlights the row you are currently moused over. Both are making use of CSS style sheet to do all of their formating. My problem is that the rollover is changing the text color but not the color of the row background as...
2
3159
by: Belinda | last post by:
Hi. I am just getting started with DB2's spatial extender and could really use some help. Pointers to good docs or examples are welcome. I am using DB2 version 8 on Sun. I have a database of genomic data and believe the spatial extender will help in querying. I have to do intersections, subtractions, proximity, etc of ranges in the chromosomes. The database and even some tables include data on all chromosomes of several species. I am...
1
1608
by: Leif K-Brooks | last post by:
I've been programming web applications in PHP/MySQL for a few years. It's worked decently, but I've been getting annoyed with the lack of more advanced features lately. After some reading, I've decided to switch to Perl/PostgreSQL. I'll be discarding all database data for other reason anyway, so moving data isn't an issue. I just want to learn how to best use some of PostgreSQL's cool features. Is there any documentation about that? I've...
2
1632
by: Steve Gollery | last post by:
I installed Postgres 8 beta 3 on an XP box, with Postgres running as a service. TaskManager tells me that postgres and postmaster are both running. Using pgAdmin III, I can connect to the server and create users, databases, tables, etc. But at the command line, on the same machine where the service is running, executing createdb mydb
5
3651
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As New System.Diagnostics.Process 'p.Start(MDEPDirStr & "macrun.exe", sPPTOut) p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE") 'p.Start("C:\WINDOWS\SYSTEM32\macrun.exe", sPPTOut)
12
1953
by: Jim Anderson | last post by:
This is my first attempt at XML documentation. I'm trying to get started with docbook so I can put a set of documentation into docbook tags. I'm using 'XML In A Nutshell" and "DocBook The Definitive Guide", both of which are a bit outdated already. I have a simple file that parses, but when I read it into Netscape or Konqueror, I do not get the results that I would hope for.
0
11708
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction message from server: "Lock wait timeout exceeded; try restarting transaction"; We get such errors generally on inserts or updates while applying a
1
1527
by: Timothy.Rybak | last post by:
I need help designing a database that keeps up with a point system we have here at work. I'll tell you what I know. First, I have a list of all the employee names for a table. Second, for various reasons that I don't want to go in to, people can earn points, in half point increments, toward a reward. Now for the tricky part. The points are calculated on a 12 month rolling sum. For every 3 months that an employee goes without...
1
3568
by: ray2heavy | last post by:
Hey guys, I am getting a "database cant lock table "blah" because it is already in use by another person or process" while trying to delete, then re-populate it. This table is viewed in a subform (CSD appender embedded) in datasheet view, and I have been changing the recordsource of the form to another table, making any changes that are required, then setting it back. This is a technique which I have been using successfully throughout the code...
0
9719
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9598
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
10371
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...
1
10373
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7650
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
5546
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
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
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.