Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Assign a CSS to a DIV

Posted on 2010-08-30
4
Medium Priority
?
358 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 2000 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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

660 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