How to format Detailsview web control with stylesheet css

Posted on 2006-05-15
Last Modified: 2008-01-09
Hello! I need to format the display of detailsview webcontrol ( using stylesheet css and not the attributes of this control. Thnaks
Question by:robossa
    LVL 14

    Expert Comment

    Give the control an ID and write some CSS specific to that ...

    DetailsView ID: myDetailsView

    Example CSS:

    #myDetailsView {
      background-color: #eee;
      border: 3px solid #000;
      color: #00f;
      font-family: Courier;

    Is that the kind of thing that you are looking for?

    Author Comment

    Thnaks. It is not working. To be more especific, I want to "translate" the format properties of the detailsview web control such as the followings in a stylesheet css. How will you do that, since the sample you wrote does not work.

    <asp:DetailsView ID="_detailsView" runat="server"                
                              AutoGenerateRows="false" DataKeyNames="BusinessListingID"                            
                              EmptyDataText="No Data"
                              AlternatingRowStyle-BackColor = "#abbde3"                   
                                    Headertext="Business or Ranch Information"
    LVL 14

    Accepted Solution

    ok, given the example above this should work:

    <style type="text/css">
      #_detailsView {
        background-color: #006;
        color: #fff;
        width: 400px;
      .detailsview {
        background-color: #abbde3;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    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.
    Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now