Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何覆盖BoundField的Itemstyle宽度?_C#_Asp.net_Css_Gridview_Width - Fatal编程技术网

C# 如何覆盖BoundField的Itemstyle宽度?

C# 如何覆盖BoundField的Itemstyle宽度?,c#,asp.net,css,gridview,width,C#,Asp.net,Css,Gridview,Width,我创建并使用了一个从BoundField继承的类。我想在我的网格中添加“Description”列,最小值为300px,但当我将Itemstyle width(和headerstyle width)设置为300px时,它在IE7和Chrome中工作,但在dumb IE8中不工作。我检查了生成的html,使其在IE8中工作的唯一方法是设置“最小宽度”而不是“宽度” 我知道我可以使用TemplateField,也可以使用ItemStyle css属性,但我认为这不是一个好方法,因为我希望能够轻松设置

我创建并使用了一个从BoundField继承的类。我想在我的网格中添加“Description”列,最小值为300px,但当我将Itemstyle width(和headerstyle width)设置为300px时,它在IE7和Chrome中工作,但在dumb IE8中不工作。我检查了生成的html,使其在IE8中工作的唯一方法是设置“最小宽度”而不是“宽度”

我知道我可以使用TemplateField,也可以使用ItemStyle css属性,但我认为这不是一个好方法,因为我希望能够轻松设置BoundField的宽度

是否有任何解决方案覆盖ItemStyle width(和Headerstyle width)属性,以便将宽度和最小宽度添加/设置到TD元素

谢谢, 迈克尔

试试这个:

ItemStyle-Width="300px" ItemStyle-Wrap="false" 

在BoundField标记中

我仍然希望将文本换行到列中,但只需设置固定宽度。我试过这个,它加了“宽度:300px;空白:nowrap;'但列的宽度为2758px。然而,它可以在IE7中使用,所以我想如果使用max width:300px,它也可以在IE8中使用,但是如果不使用css类,就找不到设置它的方法。