问题描述
我有一个asp.net表,我想格式化我列是所有相等的宽度,或者说20%,30%,20%和30%,4列。而下面的code不工作:
I've a asp.net table and I'm trying to format my columns to be all equal widths, or say 4 columns of 20%, 30%, 20% and 30%. However the following code is not working:
<asp:TableCell Width="30%">
在高度属性的作品,但是,这不是一个我之后。任何帮助非常AP preciated。谢谢
The 'height' attribute works but this isn't the one I'm after. Any help much appreciated. Thanks
推荐答案
它不工作,因为的是期待的,默认为像素..我找不到,说明如何用百分比的类型
It's not working because the Width property is expecting a value of a Unit type, which defaults to Pixels.. I couldn't find an example that shows how to create an instance of Unit with a Type of Percentage
建议你如何与CSS做到这一点。
Which leaves me to suggest how you could do it with CSS..
-
给这个TableCell的一个的CssClass,并在样式表中设置宽度
Give the TableCell a CssClass, and set the Width in a stylesheet
&LT; ASP:TableCell的的CssClass =tableCellWidth30&GT;
.tableCellWidth30 {宽度:30%; }
使用样式属性,并设置宽度内联
Use the Style property and set the Width inline
&LT; ASP:TableCell的风格=宽度:30%;&GT;
这篇关于ASPNET表 - 指定TableCell的宽度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!