问题
I need to change padding for one column in ASP.NET GridView, while all other CSS atributes defined in external CSS file should be left untouched. How can I do it?
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");
}
回答1:
You can tap into RowCommand event, which has e.Row.Cells, which you can change the styles for the cell (should have a styles collection or a CssClass property). I don't think each field (which translates to the column) has a CSS style setting...
来源:https://stackoverflow.com/questions/2342232/programatically-change-style-padding-of-a-column-in-asp-net-gridview