<asp:BoundColumn DataField="Speedway" HeaderText="交换平台" ItemStyle-Wrap="False">
<HeaderStyle Width="70px"></HeaderStyle>
</asp:BoundColumn>
<HeaderStyle Width="70px"></HeaderStyle>
</asp:BoundColumn>
解决方案 »
- sql2005 round函数随机抽取50条数据
- 虚拟机WIN 2K3,学架设服务器,不知道应该怎么配置才能支持Ajax?装何组件??
- 请教下点关于数据库的一些问题。。麻烦进来看看。谢谢了。
- 问一个关于javascript语法的问题
- https地址跳转
- 请问一下,我想运行一个cmd命令的话,用shell怎么处理?
- 简单问题!控件移动问题!
- 数据导入Excel问题
- 用户代码未处理 System.Data.SqlClient.SqlException Message=',' 附近有语法错误。 Source=.Net
- 如何将Excel表中的数据导入数据库
- 新手不解问题:关于新建一个项目
- 菜鸟请教:这个代码出现什么问题~~刚刚学几天
Dim AmcalleeDataGrid As DataGrid = New DataGrid() AmcalleeDataGrid.Width = 500
AmcalleeDataGrid.CellPadding = 2
AmcalleeDataGrid.CellSpacing = 2
AmcalleeDataGrid
{
width:200px;
text-align:left;
background-color:Aqua;
}我将上述的东西放入css中的话,如:
AmcalleeDataGrid.ItemStyle.CssClass = "AmcalleeDataGrid"却出不来预定的宽度,不知道这是什么回事
标题宽度:
if(e.Item.ItemType == ListItemType.Header)
{
e.Item.Cells[5].Font.Bold=true;
e.Item.Cells[5].Width=200;
}
单元格
if(e.Item.ItemType == ListItemType.Item||e.Item.ItemType == ListItemType.AlternatingItem){
....
}
2、动态添加列:
BoundColumn bc;
bc = new BoundColumn();
bc.HeaderStyle.HorizontalAlign=HorizontalAlign.Center;
bc.HeaderStyle.Width=(Unit)0.20;
bc.ItemStyle.HorizontalAlign=HorizontalAlign.Center;
bc.ItemStyle.Width=(Unit)0.20;
....
HyperLinkColumns TemplateColumns同上。
bc.HeaderStyle.Width=(Unit)0.20;
bc.ItemStyle.HorizontalAlign=HorizontalAlign.Center;
bc.ItemStyle.Width=(Unit)0.20;这段东西写入css呢因为我在css的class中写入
width:Unit.Pixel(100)的话,会报错的。如果不放入css的话,code中改动一个值,Rebuld完再refresh的话又得等半天了。
如果先定义DataGrid的宽度比如:300px
然后:
<asp:BoundColumn DataField="id" HeaderText="编号">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="7%"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
也可以达到相同的结果。