Changing a table properties in ASP.NET

C

Chris

This should have been easy but I can't find the answer...

I want to make every other row in my table a different row. I can't seem to
find a way to do this through my Page_Load event like I thought I would
because I can't grab the table object. The table has an ID so I don't see
why I can't reference it in my event. Can anyone shed some light on how to
go about this. Oh, I'm new to ASP.NET but do VB.NET often, so I may be
missing some simple ASP concept...

Thank
Chris
 
C

Chris

It is an <table>

I hope there is a way to do this without asp:table since the asp:table
appears harder to format my controls on the screen correctly, but that just
may be me unfamiliar with it. Can I do this change the table properties
with a <table>?

Thanks
 
C

Curt_C [MVP]

somewhat....use the
tablename.Attributes["style"] = "yourstyletags";
Again though, it's only TABLE LEVEL items that will be available, not row,
cell, etc...

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
 
J

Jos

Chris said:
This should have been easy but I can't find the answer...

I want to make every other row in my table a different row. I can't
seem to find a way to do this through my Page_Load event like I
thought I would because I can't grab the table object. The table has
an ID so I don't see why I can't reference it in my event. Can
anyone shed some light on how to go about this. Oh, I'm new to
ASP.NET but do VB.NET often, so I may be missing some simple ASP
concept...

Thank
Chris

Did you add the runat="server" attribute?
After that, you can reference your table (it will take the type of
HtmlTable). Use the Rows property to address the different
rows.
 
C

Chris

Thanks Joe, that is what I was missing, but now the new question is why I
can't access a nested Table by name.

I can see the second table my going down through the first one
OuterTable.Rows(1).Cells(0).Controls(1).ID but I can't just reference the
table named Inner when I put runat="server" on the table line. Any
Thoughts?

Chris
 
C

Chris

Sorry, it does seem to be working... Don't know what I did wrong. Thanks a
Ton.

Chris
 
C

Curt_C [MVP]

Make sure it's being defined in the code-behind. Often nested server
controls will fail to auto-generate the necessary code-behind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top