I am using a webGrid and would like to be able to change the width of the columns. I am using the following code for the style but it seems to have no affect. webGrid.Column(columnName: "TRP_Comments", header: "Comments",style: "width:500px;"), Is this not what style is suppose to do? Thanks Bruce
The style
property doesn't set the style
attribute but the class
attribute. Yeah, I know, WTF. The designers of the WebGrid component must have been mentally disturbed at the moment they choose the name of this optional argument. The whole dynamic and optional arguments stuff they put into this component makes me hate it like hell and never use it in any application.
Anyway, you could define a custom CSS class in your separate CSS file:
.comments {
width: 500px;
}
and then assign this class to the corresponding <td>
elements:
webGrid.Column(columnName: "TRP_Comments", header: "Comments", style: "comments")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With