如何控制Gridview中列的宽度。 [英] how can i control the width of columns in a Gridview.

查看:346
本文介绍了如何控制Gridview中列的宽度。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好吗



如何控制Gridview中列的宽度。



谢谢

Hi every one

how can i control the width of columns in a Gridview.

Thank you

推荐答案

您好,



网格视图设计在编辑列下有属性。



Autosizemode提供了多种选择。



对于精确宽度设置自动调整大小不设置和宽度到你需要的像素。 br />
对于要填充表格宽度的整个可用空间的列,要设置autosize以填充。

如果要填充的列数超过1,请将填充权重设置为百分比您希望该列填充的空格。
Hi,

Grid view design has properties under Edit Columns.

Autosizemode gives various options.

For exact width set autosize to not set and width to the pixels you require.
For columns to fill the whole available space in the table width set autosize to fill.
If you want more than 1 column set to fill then set the fill weight to the percentage space you want that column to fill.


对于静态列:使用HeaderStyle-Width,ItemStyle-Width或FooterStyle-Width属性。

对于动态列:在运行时设置上述属性,如:
For static columns: Use the HeaderStyle-Width, ItemStyle-Width or FooterStyle-Width properties.
For dynamic columns: Set the above said properties at runtime, like:
GridView1.Columns[i].ItemStyle.Width = colWidth;



参考:

MSDN:如何:动态设置GridView Web服务器控件列宽 [ ^ ]


这篇关于如何控制Gridview中列的宽度。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆