- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsI have an aspx page designed in Visual Studio 2005, using C#. I have a table in this page (just a plain table, not a grid), and I would like to programmatically change the width of one particular cell within this table, at run time, based on various conditions.
How can I access a single cell in a table via code?
I know that I can set the "(id)" at design time, but I don't understand how I can then reference that cell by the ID, to change it's width (probably via the "Style" attribute).
I was hoping I could do something like set the (id) to "MyCell" and then do some code like:
MyCell.Style="width: 100px"
...but VS doesn't seem to recognise "MyCell" if I try that.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: MuhammadKashifPosted on 2009-09-30 at 02:56:29ID: 25456925
you set the runat = server property.
e.g.
<td id="col1" runat="server">
now you can access col1 in your code behind file (i.e. c# file)