1

DevExpress グリッドの幅をパーセンテージで設定しようとしていますが、表示されるすべての例のようにプロパティを使用できません。MasterDetail グリッド Devexpress バージョン 12.1 を使用しています

settings.Width = Unit.Percentage(100);

グリッド全体の width プロパティを 100% に設定するにはどうすればよいですか? また、列に同じプロパティを設定するにはどうすればよいですか? これが私のグリッドです

@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

1 に答える 1

4

わかりましたので、答えを見つけました。これを解決するために私がしたことは、この using ステートメントを追加した cshtml ページの上部にありました。

@using System.Web.UI.WebControls;
于 2012-11-15T00:45:06.800 に答える