What could be causing the GridView to not apply my CSSClass?

I am currently in the process of setting up a new web page using ASP.net. I have implemented a gridview with paging, but unfortunately, the CSS class I intended to use is not being applied correctly. While the rest of the page's CSS is functioning properly, there seems to be an issue specifically with this gridview. Despite my efforts to find a solution through Google searches, I have come up empty-handed. Any assistance or guidance on this matter would be greatly appreciated!

I have attempted various troubleshooting steps such as changing 'CSS class' to simply 'class', modifying the CSS Class settings, removing the CSS link from the Site Master, and even eliminating the DIV container surrounding the Gridview. However, none of these strategies have yielded the desired outcome.

Gridview:

<%--Records of the graphed data --%>
        <div class="Records">
            <h4>Shutdown Records</h4>
            <asp:GridView ID="datagrid" runat="server" DataSourceID="SqlDataSource6" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" 
               PageSize="6" AllowPaging="True" OnPageIndexChanging="datagrid_PageIndexChanging" Width="100%">
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
                ConnectionString="<%$ ConnectionStrings:Automation %>"
                ProviderName="System.Data.SqlClient" SelectCommand="select ShutdownDate, ShutdownNotes, StartupDate, StartupNotes, Cast
    (
        Round 
        (
            (
            Cast
                (
                SUM(TotalDownTime)as decimal(18, 2)
                )/3600
            )
        , 2 
        ) as decimal(18, 2) 
    ) as 'Duration of Shutdowns (Hours)' 
    from ProductionShutdownRecord 
    where Reason like '%'+@Reason+'%'
    and ShutdownNotes like '%'+@shutdownNotes+'%'
    and StartupNotes like '%'+@startupNotes+'%'
    and ShutdownDate &gt;= @startDate
    and ShutdownDate &lt;= @endDate
    and AMSTaskRelated like 
        CASE 
            when @AMS = 1 then '%1%'
            else '%%'
        END
    group by ShutdownDate, ShutdownNotes, StartupDate, StartupNotes
    order by shutdowndate asc
    ">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList1" DefaultValue="Scheduled Release" 
                            Name="Reason" PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="shutdownNotes" ConvertEmptyStringToNull="False" 
                            Name="shutdownNotes" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="startupNotes" ConvertEmptyStringToNull="False" 
                            Name="startupNotes" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="startDate" ConvertEmptyStringToNull="False" 
                            Name="startDate" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="endDate" ConvertEmptyStringToNull="False" 
                            Name="endDate" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="AMSCheck"
                            Name="AMS" PropertyName="Checked"/>
                    </SelectParameters>
            </asp:SqlDataSource>
        </div>
    

CSS:

/* Gridview Style
-------------------------------------------------------------------------------------------------------------*/
.mGrid {
    width: 100%;
    background-color: #fff;
    margin: 5px 0 10px 0;
    border: solid 1px #525252;
    border-collapse: collapse;
}

    .mGrid td {
        padding: 2px;
        border: solid 1px #c1c1c1;
        color: #717171;
    }

    .mGrid th {
        padding: 4px 2px;
        color: #fff;
        background: #424242 url(grd_head.png) repeat-x top;
        border-left: solid 1px #525252;
        font-size: 0.9em;
    }
    
    .mGrid .alt {
        background: #fcfcfc url(grd_alt.png) repeat-x top;
    }
    
    .mGrid .pgr {
        background: #424242 url(grd_pgr.png) repeat-x top;
    }
    
        .mGrid .pgr table {
            margin: 5px 0;
        }
    
        .mGrid .pgr td {
            border-width: 0;
            padding: 0 6px;
            border-left: solid 1px #666;
            font-weight: bold;
            color: #fff;
            line-height: 12px;
        }
    
        .mGrid .pgr a {
            color: #666;
            text-decoration: none;
        }
    
            .mGrid .pgr a:hover {
                color: #000;
                text-decoration: none;
            }
    

Expected Result: I am attempting to apply this CSS Template:

Actual Result: Despite my efforts, all I see is a plain white gridview.

Answer №1

To ensure future reference, I will provide the solution to this question here.

To clear your browser's cache, simply use the keyboard shortcut Ctrl + Shift + R. Browsers often store resources like javascript and css files in their cache for faster loading times upon revisiting a website. If changes you have made to your CSS are not reflecting, chances are your browser is still using the cached version.

If you are worried about users seeing outdated cached resources instead of the updated ones, explore these cache busting techniques to mitigate these potential issues.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having an excessive amount of data bound to a combo box can result in performance issues

I'm facing an issue with a large amount of data, around 5000 to 6000 records. When I bind all these records to a combo box, it becomes slow and delays in expanding, selecting, and sometimes even hangs the page entirely. Is there any solution to this ...

Flexbox CSS Card Layout Behavior

Looking to achieve a specific design effect without relying on Semantic UI? Check out the codepen link here: https://codepen.io/anon/pen/YxBOax <div class="ui container"> <div class="ui four cards stackable"> <div class="teal card"> ...

Encountered a situation where a duplicate key was found while attempting to set <compilation debug="false"> in the web.config

During the process of compiling my ASP.NET application using C#, I adjusted the compilation debug="false" setting in Web.config to enhance performance. After deploying the application on my development machine, everything was functioning properly. However ...

Is there a way to automatically trigger an Anthem.NET button click event upon page load in ASP.NET?

My goal is to initiate the loading of an ASP.NET page followed by triggering a server-side event that will update some HTML on the client side. The event is associated with an Anthem.NET imagebutton control, so the most obvious approach would be to simply ...

What is the best way to format a pseudo-element to serve as the header for a paragraph?

We are utilizing Markdown (Kramdown) for generating a static website. When incorporating infoboxes, we can enhance paragraphs and achieve the following outcomes: {:.note .icon-check title="This is a title"} Lorem, ipsum dolor sit amet consectetur adipisici ...

The Best Method for Retrieving a Single Row of Data from a Database in ASP.NET

My current task involves writing a method to retrieve an 'asset' row from the database, containing various data types such as strings, ints, and byte arrays (which could represent images, movies, or documents). Typically, I utilize a method that ...

What is the process for creating an expression that can be compiled into a Func<T>?

Imagine having a static method that returns T, like so: T value = MyClass.Generate(type); // type is System.Type The challenge arises when attempting to construct and compile an expression in order to obtain a Func<T>. It seems to be quite perplexi ...

PHP quiz with results displayed in an aligned manner

I created a html quiz with php as my back-end. Everything is working correctly, but I'm having trouble centering the results on the page. Currently, they are aligned to the left. Can someone provide guidance on how to achieve this? This is my first ti ...

Auto-closing dropdown menus in the navbar of a Shiny app with Bootstrap

Is there a way to customize the behavior of a shiny navbarMenu so that when I click inside or outside it, the dropdown does not automatically hide? I have seen mentions of using data-bs-auto-close="false" in the Bootstrap documentation, has anyon ...

What are the steps to design a curved trapezoid using CSS?

Is it possible to achieve this using CSS? This is the current progress I've made: div { -webkit-clip-path: polygon(0 79%, 60% 78%, 78% 100%, 0 100%); clip-path: polygon(0 79%, 60% 78%, 78% 100%, 0 100%); background:red; height:300px; ...

Encountering an error stating "Invalid directory" while trying to compress files using SharpZipLib

For the purpose of optimizing a file compression process, I have developed a function that is responsible for compressing a list of files from the user's session. The compressed files are then streamed to the user's browser for downloading: publ ...

Struggling to Narrow Down a LINQ Query with an Entity Framework Navigation Property?

I require assistance with filtering a LINQ query on an Entity Framework (EF) navigation property. The tables were not generated using code-first approach. Let's use characters from The Office to illustrate this issue. Imagine the following tables an ...

The hover effect in CSS animations is turned up too high

Check out my Reddit news feed design: https://codepen.io/Teeke/pen/YxXXaE When hovering over articles, the headlines get displayed. But if the article text is too long, part of the headline may go off-screen. Instead of changing the line-height, I' ...

``It seems like the Tailwind background image is not appearing on

The issue lies in the background image not displaying despite trying different methods such as using ""bg-[url('/image/example.jpeg')"" tailwind.config.js theme: { extend: { colors: { darkBlue: "#0 ...

Customizing Bootstrap to automatically display a modal without the need for a button click

According to the Bootstrap website, modals are typically triggered using buttons. As I am working with React, I would like to control when the modal is displayed using JavaScript. Is there a way to have the modal appear by default? Here is the code snip ...

Query to update multiple documents in a collection using joins and UpdateManyAsync in C# with the Mongo

I am currently managing 2 collections: ProductCategory _id name active Product _id CategoryId DateUpdated To simplify the update process for one collection, I utilize a filter and UpdateManyAsync method like so: var update = Builders<P ...

Retrieve the entire table and paste it into the editor's content

I have a table with a Rad Editor <table id="MyTable" width="200" border="1" cellpadding="8" style="display:none"> <tr> <td><p id="Title" runat="server" style="text-align: center"></td> </tr> <tr> <t ...

Error message displaying NaN and issues with setting class using color function in console log

The console log is displaying NaN for any variable I input. Additionally, the color function is not correctly changing classes, likely due to the number issue. I still need to address local storage, but my main focus is on getting the variable to display ...

Monitor the pages that have been viewed

One method I have implemented in my quiz application is to randomly select one of five pages using the following code: protected void openNewPage(object sender, EventArgs e) { int random = new Random().Next(5) + 1; Response.Redirect(st ...

What is the best way to ensure that an anchor in a scrolling list adjusts its width based on its children's content?

Check out the setup I have here: http://jsfiddle.net/9F6CF/ In this scenario, there is a list containing anchors within each list item. The UL element has a specific width and an overflow set to auto, causing text in the anchors to scroll horizontally if ...