ASP.NET Programmatically assign CSS ID to a <div>

Posted on 2009-04-02
Medium Priority
Last Modified: 2012-05-06
I have a sample ASPX page with a few styles assigned (see code below)
Styles were created in VS2008

1)  I want to programmatically (using VB) add a DIV in the page and want the freedom of using a choice of the EXISTING styles currently defined in the style section of the aspx page, without having to recode the styles - some code examples will be appreciated.

2) Is it possible to place a general div in the aspx page and change its id programmatically - although I suppose this is possible ? - but rather to use a placeholder ?

Any suggestiions welcome



Part of ASPX page......
<style type="text/css">
            background-color: #FFFFCC;
            width: 200px;
            height: auto;
            background-color: #99CCFF;
            width: 500px;
            height: 200px;
            background-color: #66FF33;
            width: 500px;
            height: 200px;

Open in new window

Question by:cassiec
1 Comment
LVL 14

Accepted Solution

amar31282 earned 1500 total points
ID: 24053510

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question