设置DataGrid自动生成列的宽度
生活随笔
收集整理的這篇文章主要介紹了
设置DataGrid自动生成列的宽度
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在DataGrid的ItemCreated事件里可以
private?void?DataGrid1_ItemCreated(object?sender,?System.Web.UI.WebControls.DataGridItemEventArgs?e)
{
for(int?i=0;i<=e.Item.Cells.Count-1;i++)
{
??e.Item.Cells[i].Attributes.Add("Width","100px");
}
}
private?void?DataGrid1_ItemCreated(object?sender,?System.Web.UI.WebControls.DataGridItemEventArgs?e)
{
for(int?i=0;i<=e.Item.Cells.Count-1;i++)
{
??e.Item.Cells[i].Attributes.Add("Width","100px");
}
}
轉載于:https://www.cnblogs.com/leeon/archive/2004/12/10/75107.html
總結
以上是生活随笔為你收集整理的设置DataGrid自动生成列的宽度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: eclipse入门指南
- 下一篇: 关于《用C#编写ActiveX控件》的几