[英]How to set padding for gridview data with C#?
I have populated a gridview with C#, but the data in the girdview is very close to the cell borders. 我已经用C#填充了一个gridview,但是girdview中的数据非常接近单元格边界。 How can I take away the padding for the cell content with C#?
如何使用C#删除单元格内容的填充?
string query = "SELECT * FROM `fabrica`";
//'bd' and 'ExecuteRead' is my database classe
DataTable table = bd.ExecuteRead(query);
table.Columns["id"].ColumnName = "ID";
table.Columns["nome"].ColumnName = "Nome";
table.Columns["cidade"].ColumnName = "Cidade";
table.Columns["estado"].ColumnName = "Estado";
table.Columns["telefone1"].ColumnName = "Telefone 1";
table.Columns["telefone2"].ColumnName = "Telefone 2";
table.Columns["telefone3"].ColumnName = "Telefone 3";
table.Columns["email1"].ColumnName = "Email 1";
table.Columns["email2"].ColumnName = "Email 2";
table.Columns["email3"].ColumnName = "Email 3";
Tabela.DataSource = table;
Tabela.ControlStyle.Width = 885;
Tabela.DataBind();
You can use CellPadding property. 您可以使用CellPadding属性。
Tabela.CellPadding = 10;
Reference : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.cellpadding.aspx 参考: http : //msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.gridview.cellpadding.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.