Skip to content

Grid Component : Conditional css class for grid row #248

Closed Answered by gvreddy04
joselitogatchalianalonzo asked this question in Q&A
Discussion options

You must be logged in to vote

Default Example: https://demos.blazorbootstrap.com/grid#conditional-css-class-for-grid-row

Now, add the below custom CSS class to your .css file:

.table-row-yellow {
    --bs-table-color: #000;
    --bs-table-bg: #F8D81D;
    --bs-table-border-color: #DFC32A;
    --bs-table-striped-bg: #ECCD89;
    --bs-table-striped-color: #004;
    --bs-table-active-bg: #DFC364;
    --bs-table-active-color: #000;
    --bs-table-hover-bg: #E5C865;
    --bs-table-hover-color: #000;
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}

Update the GetRowClass(.....) method with the new custom CSS class.

    private string GetRowClass(Employee1 emp)
    {
        if (!emp.IsActive

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by gvreddy04
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
✔️ Resolution: Answered Resolved because the question asked by the original author has been answered.
2 participants
Converted from issue

This discussion was converted from issue #244 on June 28, 2023 07:17.