2012-11-14 3 views
1

DevExpress 그리드의 너비를 백분율로 설정하려고합니다. 볼 수있는 모든 예와 같이 속성을 사용할 수 없습니다. 나는 colums에 대해 동일한 속성을 설정 얼마나 나는 또한 DevExpress의 버전 다음 12.1Devexpress mvc4 격자 너비 설정

settings.Width = Unit.Percentage(100); 
내가 100 %로 전체 그리드 폭 속성을 설정하는 방법

와 MasterDetail 그리드를 사용하고 있습니다. 여기 내 격자가 있습니다

@Html.DevExpress().GridView(
settings => { 
    settings.Name = "masterGrid"; 
    settings.CallbackRouteValues = new { Controller = "InwardsGoods", Action = "GridViewMasterPartial" }; 
    settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "InwardsGoods", Action = "GridViewMasterAddNewPartial" }; 
    settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "InwardsGoods", Action = "GridViewMasterUpdatePartial" }; 
    settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "InwardsGoods", Action = "GridViewMasterDeletePartial" }; 
    settings.KeyFieldName = "InwardsGoodsID"; 

    settings.Columns.Add(column => 
    { 
     column.FieldName = "CustomerID"; 
     column.Caption = "Customer"; 
     column.ColumnType = MVCxGridViewColumnType.ComboBox; 
     var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties; 
     comboBoxProperties.DataSource = Model.CustomersList; 
     comboBoxProperties.TextField = "CustomerName"; 
     comboBoxProperties.ValueField = "CustomerID"; 
     comboBoxProperties.ValueType = typeof(int); 
    });  

    settings.Columns.Add(column => 
    { 
     column.FieldName = "CustomerReference"; 
     column.Caption = "Customer Reference";   
    }); 
    settings.Columns.Add(column => 
    { 
     column.FieldName = "TimberShadeReference"; 
     column.Caption = "TimberShade Reference"; 
    }); 
    settings.Columns.Add(column => 
    { 
     column.FieldName = "DateReceived"; 
     column.Caption = "Date Received"; 
     column.PropertiesEdit.DisplayFormatString = "d";    
    }); 

    settings.Columns.Add(column => 
    { 
     column.FieldName = "Comment"; 
     column.Caption = "Comment"; 
    }); 

    settings.SettingsDetail.AllowOnlyOneMasterRowExpanded = true; 
    settings.SettingsDetail.ShowDetailRow = true; 
    settings.CommandColumn.Visible = true; 
    settings.CommandColumn.NewButton.Visible = true; 
    settings.CommandColumn.DeleteButton.Visible = true; 
    settings.CommandColumn.EditButton.Visible = true; 

    settings.SetDetailRowTemplateContent(c => 
    { 
     Html.RenderAction("GridViewDetailPartial", new { inwardsgoodsID = DataBinder.Eval(c.DataItem, "InwardsGoodsID") }); 
    }); 

    //TO OPEN THE FIRST EDITABLE ROW 
    //settings.PreRender = (sender, e) => 
    //{ 
    // ((MVCxGridView)sender).DetailRows.ExpandRow(0); 
    //}; 

}).Bind(Model.InwardsGoods).GetHtml() 

답변

4

좋아, 그래서 대답을 찾았습니다. 이 문제를 해결하기 위해 내가 한 것은 cshtml 페이지의 맨 위에이 문장을 사용하여 추가 한 것입니다.

@using System.Web.UI.WebControls;