2011-11-17 15 views
1

問:如何使用mvc3 webgrid的寬度重新調整大小(寬度爲100%的寬網格視圖)?如何用webgrid調整身體大小?

enter image description here

CSS -

.webgrid /* This works fine...stretches 100% with scrollbars at bottom of browser 
{ 
    width: 100%; 
} 

body 
{ 
    /* What can I put here for width: "Stretch the body the same % or length as the webgrid */ 
    /* width: 100% <- DOESN'T WORK!!! Grid still runs over body page! */ 
} 

剃刀(CSHTML) -

<div id="grid" class="gen"> 
    @grid.GetHtml(
     tableStyle: "webgrid",...) 

回答

0
當你實現鑑於電網和設置在TABLESTYLE像參數

 @grid.GetHtml(tableStyle: "grid",.............) 

接你在TABLESTYLE有的名稱,並用它作爲一類

<style type="text/css"> 
.grid{ 

    width:100px; 
    } 

</style> 

我認爲它的工作原理

+0

嗨,感謝您的回覆。這並不能解決問題。在原始帖子中查看我的修改。這實際上是我目前實施的(webgrid的寬度爲100%)。問題是當網格很寬時(以及網格設置爲100%),主體不會重新調整大小。 – JaJ

0

表的單元格不能小於其內容更小。

一些解決方案:

  1. 考慮,只顯示在細節上查看一些列;
  2. 提供帶有工具提示的單元格,並儘量減少文本長度;
  3. 增加整個頁面的寬度。

希望得到這個幫助。

0

在Site.css中,對於類webgrid-Style,將寬度更改爲100%。