By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,008 Members | 2,962 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,008 IT Pros & Developers. It's quick & easy.

Changing a table properties in ASP.NET

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
is it a <table...>
or <asp:Table...>
?
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Chris" <cf@NoSpamzieQuotepro.com> wrote in message
news:ua**************@TK2MSFTNGP10.phx.gbl...
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

Nov 18 '05 #2

P: n/a
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

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
is it a <table...>
or <asp:Table...>
?
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Chris" <cf@NoSpamzieQuotepro.com> wrote in message
news:ua**************@TK2MSFTNGP10.phx.gbl...
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


Nov 18 '05 #3

P: n/a
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
"Chris" <cf@NoSpamzieQuotepro.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
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

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:OC**************@tk2msftngp13.phx.gbl...
is it a <table...>
or <asp:Table...>
?
--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Chris" <cf@NoSpamzieQuotepro.com> wrote in message
news:ua**************@TK2MSFTNGP10.phx.gbl...
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



Nov 18 '05 #4

P: n/a
Jos
Chris wrote:
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.

--

Jos Branders
Nov 18 '05 #5

P: n/a
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



"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Chris wrote:
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.

--

Jos Branders

Nov 18 '05 #6

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

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Chris" <cf@NoSpamzieQuotepro.com> wrote in message
news:OF**************@TK2MSFTNGP12.phx.gbl...
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



"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Chris wrote:
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.

--

Jos Branders


Nov 18 '05 #7

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

Chris

"Jos" <jo***************@fastmail.fm> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Chris wrote:
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.

--

Jos Branders

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.