Solved

Assign a CSS to a DIV

Posted on 2010-08-30
4
354 Views
Last Modified: 2012-05-10
OK, let me first start by saying I'm NEW to ASP.net, so I hope this question doesn't sound stupid!

I have a DIV inside a Content Place Holder so I can change the width and background color to something different from the Master Page.
Here is an example of what it looks like now:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <div style="width: 1000px; background-color:White">

I would like to move these settings to a CSS file instead of having them set in the form, so I can swap out files at will.  I would like the CSS file to contain my width: 1000px and background-color:White so I can change these files in out based on a report selected.

You see I have a Crystal Report Viewer inside a Content Place Holder and I would like to change the width of the DIV when the report is Landscape vs. Portrait, so that the report shows behide a White Background vs. a green background on the Master Page.

Thanks,
Mark
0
Comment
Question by:smithmrk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 33561924
<div class="fakefile">

one way would be to create a class in your css file and then set <div class="mycalss">

another way would be giving your div an id :

<div id="mydiv">

and then in your css file using div id to set the properties
0
 
LVL 35

Expert Comment

by:YZlat
ID: 33561976
  <div style="width: 1000px; background-color:White">

div.myclass
{
  WIDTH: 1000px;
  BACKGROUND-COLOR: White;
}
0
 
LVL 35

Expert Comment

by:YZlat
ID: 33562008
you could also use jquery:

$("#myDiv").addClass('myClass');
0
 

Author Closing Comment

by:smithmrk
ID: 33562221
Thank You!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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