Programmatically change column style (padding) in ASP.NET GridView

I need to change the padding for a single column in an ASP.NET GridView, while all other CSS attributes defined in the external CSS file should be left untouched. How can i do this?

Thanks in advance!

Update: Below is my code that solved the problem:

protected void gvwMaster_RowDataBound(object sender, GridViewRowEventArgs e)
{
    e.Row.Cells[0].Attributes.Add("style", "padding:0");
}
+3
source share
1 answer

You can use the RowCommand event that has e.Row.Cells, which you can change the styles for the cell (must have a collection of styles or a CssClass property). I don't think that every field (which translates into a column) has a CSS style setting ...

0
source

Source: https://habr.com/ru/post/1734556/


All Articles