How to format Detailsview web control ASP.net with stylesheet css

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

Expert Comment

ID: 16685422
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

ID: 16686039
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

dfu23 earned 1000 total points
ID: 16686514
ok, given the example above this should work:

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

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

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
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…
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

609 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