我需要改变填充在ASP.NET GridView的一列,而在外部CSS文件中定义的所有其他CSS atributes应保持不变。我该怎么办呢?
在此先感谢!
更新: 下面是我的code,它解决了这个问题:
保护无效gvwMaster_RowDataBound(对象发件人,GridViewRowEventArgs E)
{
e.Row.Cells [0] .Attributes.Add(风格,填充:0);
}
解决方案
您可以点击进入RowCommand事件,其中有e.Row.Cells,您可以更改样式的单元格(应该有一个风格的集合或的CssClass属性)。我不认为每个字段(这相当于柱)有一个CSS样式设置...
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");
}
解决方案
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...