We help IT Professionals succeed at work.

Problem Formatting GridView using .CSS  in Site.Master Sub-Form

baasassasin
baasassasin asked
on
425 Views
Last Modified: 2013-11-26
To sum it up, I have a Site.Master, a sub form, and a .css stylesheet.  The sub form has a GridView in it.  I have the CssClass="gvw" for the gridview, but it still won't pick up the formatting from the stylesheet.  The Site.Master links to my stylesheet named Styles.css.  Other controls are formatted fine using this, which tells me that the stylesheet is linking fine in the sub forms, however, the gridview WILL NOT FORMAT.  The gridview css formatting displays in the designer, but in runtime, all formatting is lost.

Here is my Styles.css:

.gvw
{
    background-color:#ED9F9F;
    border: 2px solid #711515;
    padding:2px;
}

THE GRIDVIEW WILL NOT FORMAT USING THE ABOVE .CSS.  ANY IDEAS?


Comment
Watch Question

Jens FiedererTest Developer/Validator

Commented:
Bring up the web page and do a "View Source" on it, and you should get a clue as to the source of the problem.

If you don't understand it, post it.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
1) Are you using themes?

2) Do you have a link in the page for the CSS file?
    <link type="text/css" href="Main.css" />

Bob
what happens when you move the style .gvw from the stylesheet to the sub form .. does the grid get formatted?

Rejo

Author

Commented:
Here's the source:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="ctl00_Head1"><title>
      Untitled Page
</title><link href="../Styles.css" rel="stylesheet" type="text/css" /></head>
<body>  
    <div id="wrapper">  
        <form name="aspnetForm" method="post" action="EmpMaint.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="nCyw1aTUXp07jANTB0f++D9vyXCnNR+qGrHwYdjg+ypr6k60E+SbUX/E77ubWD0m/qbz0vmYDAnk0SLlxEsatoJSY+UV9jFMj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HkBgVHMGvv53OpjpYfIQO/h/5e7aowzPlNaegUNwjZFNUpTiArX5XhF/0dekQ1/4jOsbmNwCpNiThoMwzLeliPnM7CIzxfFQlPzJGNcU+92aQPggOJj4NimoATGLOdeVN2ayGbCiUAdM4CfEKrLC6fKum3BqHuhi701tofX+/BTk8dkIO/m/YrB+oR5mi+dovPQSd7VU8QveJhOA5ebZAWXYsKEB6dy4ohHS0pOGGPDI1DsACZfBluPWK/6XFXeP482E7waHu9AOivVT+hCHKkxBq1ob3b6Ca1dyf86beC7zWRWJvbxUnkJJP19v48K1kD/sjfFPCXrKq8X0OjSGQ0nQX5LTUgIu2E4A8shPA0wJw3R28AbW9HL1nwTBxFfTJya0SPvsCiNFOOTiwS3kECJMNfoC9e4hUMMLApfIqDuZEgMjqTR1s0V5BOHBEhGmW9fxJXmdC0huwlno41lLUXL9F6gcr2eo9FKtOHh58roJuZWsxyIuh465rrERcRKpv5FfMdaJ7bTjFhZOp7KW67RrMjMk9OPPIkMFsg4JD7FDjvklr5nooNsXe+JMncIaM6kQPf/PPK72cavpLSSmTOZTPxn8HLjbzTj3VWQy0WalF2B3XFGeSgBaLKa1JO3/8qTTGSRi+Msbn7xs+fkSBv/TfMIyVUhjLQrbqxEyr189V2AdADAWD5chhKt72o/XvVk9KZhtUIq1G+xSIv5wozBfc6yq+WowABhj5Exdwh3jF8VFsNTrYzZ3BjQJ8ytXHlSWTgqoPC9JLIoxd3gglZcLtSmF/WdxicHjknDOqp2aNBQobnCEHACWc9X3mNsF9tD2Q33+5GfI7+d6yr4uyBhi//A7/gvdGcno=" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->

</script>

 
            <div id="header">  
                <span class="title">PEDALVALVES</span>  
                <span class="breadcrumb">
                    <span id="ctl00_SiteMapPath1"><a href="#ctl00_SiteMapPath1_SkipLink"><img alt="Skip Navigation Links" height="0" width="0" src="/PedalValves/WebResource.axd?d=F2YlejThtjuQsK8y4XrqhQ2&amp;t=633232818470058575" style="border-width:0px;" /></a><span><a title="Home" href="/PedalValves/Default.aspx">Home</a></span><span> &gt; </span><span><a title="Employee Maintenance" href="/PedalValves/EmployeeMaintenance/Default.aspx">Employee Maintenance</a></span><span> &gt; </span><span>View and Edit Employees</span><a id="ctl00_SiteMapPath1_SkipLink"></a></span> </span>
                <a id="ctl00_LoginStatus1" href="javascript:__doPostBack('ctl00$LoginStatus1$ctl02','')">Login</a>

            </div>  
            <div id="content">  
               
    <div>
      <table class="gvw" cellspacing="0" rules="all" border="1" id="ctl00_MainContent_grdEmp" style="border-collapse:collapse;">
            <tr>
                  <th scope="col">Emp#</th><th scope="col">Status</th><th scope="col">Division</th><th scope="col">Name</th><th scope="col">Address</th><th scope="col">City</th><th scope="col">State</th><th scope="col">ZipCode</th><th scope="col">CellPhone</th><th scope="col">HomePhone</th><th scope="col">OtherPhone1</th><th scope="col">OtherPhone2</th><th scope="col">Email</th>

            </tr><tr>
                  <td>3</td><td>Active</td><td>Both</td><td>
                Donnie&nbsp;Matthews
                </td><td>502 Monsanto Ave</td><td>Luling</td><td>LA</td><td>70070</td><td>(408) 201-5751</td><td>(985) 331-8850</td><td>(585) 792-5587</td><td>&nbsp;</td><td>dmatthews@gpvi.com</td>

            </tr><tr>
                  <td>4</td><td>Active</td><td>Both</td><td>
                Robby&nbsp;Gilbert
                </td><td>102 Azelea Cr</td><td>Luling</td><td>LA</td><td>70070</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr><tr>

                  <td>5</td><td>&nbsp;</td><td>Both</td><td>
                Jason&nbsp;Wilkie
                </td><td>103 Azelea Ct</td><td>Luling</td><td>LA</td><td>70070</td><td>(408) 201-5751</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr><tr>
                  <td>6</td><td>&nbsp;</td><td>Both</td><td>

                Chad&nbsp;Nuccio
                </td><td>201 Frizzle Creek Rd</td><td>Brookhill</td><td>SC</td><td>44567</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr><tr>
                  <td>7</td><td>&nbsp;</td><td>Both</td><td>
                Todd&nbsp;Gilder
                </td><td>222 Beaver Rd</td><td>Antioch</td><td>MD</td><td>32323</td><td>(504) 123-4567</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>

            </tr><tr>
                  <td>8</td><td>&nbsp;</td><td>Conservation</td><td>
                John&nbsp;Doe
                </td><td>321 Juloq Rd</td><td>Fresno</td><td>MI</td><td>25899</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr><tr>
                  <td>202</td><td>&nbsp;</td><td>Conservation</td><td>

                Cresto&nbsp;Whitson
                </td><td>302 Aston Ln.</td><td>Falltown</td><td>CA</td><td>48716</td><td>(555) 258-4472</td><td>(555) 521-4721</td><td>&nbsp;</td><td>&nbsp;</td><td>dedhed@fps.net</td>
            </tr><tr>
                  <td>405</td><td>&nbsp;</td><td>Conservation</td><td>

                Spartian&nbsp;Joseph
                </td><td>105 Arlington Rd.</td><td>Credo</td><td>MN</td><td>44578</td><td>(111) 256-6355</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr><tr>
                  <td>101</td><td>Active</td><td>Metering</td><td>
                Rad&nbsp;Bush
                </td><td>1110 N 8th St.</td><td>Lamesa</td><td>TX</td><td>79331</td><td>(111) 222-3344</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>

            </tr><tr>
                  <td>764</td><td>Active</td><td>Metering</td><td>
                Sharon&nbsp;DeLanzo
                </td><td>28201 Najean Rd.</td><td>Abita Springs</td><td>LA</td><td>70420</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr><tr>

                  <td>128</td><td>Active</td><td>Metering</td><td>
                David&nbsp;Lowe
                </td><td>104 Crenshaw Dr.</td><td>Bourg</td><td>LA</td><td>70343</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
            </tr>
      </table>

</div>
   
    <br />
    <br />
    <br />
 
            </div>  
            <div id="navigation">  
                <ul>  
                    <li><a id="ctl00_lnkHome" href="../Default.aspx">Home</a>
                   
                     
                            <li>  
                                <a id="ctl00_menu_ctl00_HyperLink1" href="/PedalValves/EmployeeMaintenance/Default.aspx">Employee Maintenance</a>  
                                   
                                     
                                            <ul>  
                                         
                                            <li>  
                                            <a id="ctl00_menu_ctl00_Repeater1_ctl01_HyperLink2" href="/PedalValves/EmployeeMaintenance/EmpMaint.aspx">View and Edit Employees</a>  
                                            </li>  
                                         
                                            </ul>  
                                         
                                </li>  
                             
                            <li>  
                                <a id="ctl00_menu_ctl01_HyperLink1" href="/PedalValves/BasicReporting/Default.aspx">Basic Reporting</a>  
                                   
                                     
                                            <ul>  
                                         
                                            <li>  
                                            <a id="ctl00_menu_ctl01_Repeater1_ctl01_HyperLink2" href="/PedalValves/BasicReporting/RepeatersAndGrids.aspx">Repeaters and Grids</a>  
                                            </li>  
                                         
                                            <li>  
                                            <a id="ctl00_menu_ctl01_Repeater1_ctl02_HyperLink2" href="/PedalValves/BasicReporting/DeclarativeParams.aspx">Space Filler</a>  
                                            </li>  
                                         
                                            </ul>  
                                         
                                </li>  
                             
                            <li>  
                                <a id="ctl00_menu_ctl02_HyperLink1" href="/PedalValves/SecretFiles/Secret.aspx">ProtectedFiles</a>  
                                   
                                     
                                            <ul>  
                                         
                                            <li>  
                                            <a id="ctl00_menu_ctl02_Repeater1_ctl01_HyperLink2" href="/PedalValves/SecretFiles/Secret1.aspx">Space Filler2</a>  
                                            </li>  
                                         
                                            </ul>  
                                         
                                </li>  
                             
                            <li>  
                                <a id="ctl00_menu_ctl03_HyperLink1" href="/PedalValves/LoggedOn.aspx">Currently Logged On</a>  
                                   
                                     
                                            <ul>  
                                         
                                            <li>  
                                            <a id="ctl00_menu_ctl03_Repeater1_ctl01_HyperLink2" href="/PedalValves/default2.aspx">ProtectedFiles</a>  
                                            </li>  
                                         
                                            </ul>  
                                         
                                </li>  
                             
                            <li>  
                                <a id="ctl00_menu_ctl04_HyperLink1" href="/PedalValves/Personal/default.aspx">My Info</a>  
                                   
                                     
                                            <ul>  
                                         
                                            </ul>  
                                         
                                </li>  
                             
                            <li>  
                                <a id="ctl00_menu_ctl05_HyperLink1" href="/PedalValves/Employees/Default.aspx">Employees</a>  
                                   
                                     
                                            <ul>  
                                         
                                            </ul>  
                                         
                                </li>  
                              </li>  
                </ul>  
                 
            </div>
       

<div>

      <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
      <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="HVt6OvqvkJGmzPLEI+XsujYptm95eLE4537pUfS75+s=" />
</div></form>  
    </div>
</body>
</html>
Jens FiedererTest Developer/Validator

Commented:
when I take your html and put it in a file on my machine - and then put a Styles.css WHERE IT CAN BE FOUND - the .gvw style is APPLIED to your grid.

Double and triplecheck your <link> statement....is the Styles.css really in the PARENT directory?
Test Developer/Validator
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
You've got to be joking.  My dad always taught me to check the simple things first.

It was the cache.

You are great.  Thanks for the help!!!!
Jens FiedererTest Developer/Validator

Commented:
My pleasure ... didn't think of it at first myself, although it's happened to me a COUPLE of times!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.