如何确定列的宽度 [英] How can determine the width of the column
本文介绍了如何确定列的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以通过GridView向我提供有关确定列宽度的信息
谢谢....
解决方案
您可以尝试在RowDataBound
事件上设置宽度
protected void GridView1_RowDataBound( object sender,GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells [ 0 ]。宽度= 新单位( 600px的跨度>);
}
}
我已准备好使用GridView1.Columns [ 0 ]。ItemStyle.Width = 50 ;
但它说错误:
{索引超出范围。必须是非负数且小于集合的大小。\\\\ nParameter name:index}
can any body provide me about determine the width of the column with GridView
thanks....
解决方案
You can try to set the width onRowDataBound
event
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if( e.Row.RowType == DataControlRowType.Header ) { e.Row.Cells[0].Width =new Unit("600px"); } }
i all ready useGridView1.Columns[0].ItemStyle.Width = 50;
but it say error :
{"Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index"}
这篇关于如何确定列的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文