2

Maybe I am blind, but I am not able to find how to change css class attributte for entire table generated by Grid.MVC.

Default css class settings:

<table class="table table-striped grid-table">

And I want to edit that. I have a workaround now in javasript. It works but there has to be some better solution at server side.

2 Answers 2

11

I finnaly found that there is a shared view in ~/Views/Shared (_Grid.cshtml). There you can edit the whole grid.

Sign up to request clarification or add additional context in comments.

Comments

0

You don't want to assign styles on the server side. You always want that to happen on the client side. the classes you are referencing in your table tag are the reason why your table looks the way it does. If you want to change the look of the table you have three choices:

  1. You can create new CSS style classes and add them to your CSS and change the referenced classes in your table tag.
  2. You can edit the existing CSS classes in the CSS file to suit your needs.
  3. You can override the style you want by adding them inline on your table tag using the style attribute.

Edited to add:

According to the documentation for Grid.Mvc you can change your table styles in Content/Gridmvc.css

4 Comments

Css classes that are generated on server side (table table-striped) are bootstrap css classes. It would be strange if I wasn't able to change these css classes. I defninitely don't want to edit these bootstrap classes.
Bootstrap is a JavaScript library which by default makes it runs client side. Not server side. Your three choices are the ones I mentioned above. Personally, I would write my own CSS classes in my site.css and I would reference those in my table tag.
You misunerstood my question. I want to change the value of class atributte of the table tag. The tag is generated server-side.
This is quite not what I was looking for. I just want to add a (bootstrap) css to the class atributte. I don't want to change css styles. I just want it to look like this: <table class="table table-striped table-bordered table-condensed grid-table"> instead of this: <table class="table table-striped grid-table">.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.