简体   繁体   English

在ASP.NET MVC中的Kendo网格CSS

[英]Kendo grid css in asp.net mvc

I have a two kendo grids in one view page that i want to display beside each other. 我在一个视图页面中有两个剑道网格,我想彼此并排显示。 To change one character of the css style of a kendo grid using asp.net i use 要使用asp.net更改剑道网格的css样式的一个字符,我使用

       .HtmlAttributes(new { style="width:50%"})

now i want to change more than one character, so i tried adding to the second grid this code but it is not working: 现在,我想更改多个字符,因此我尝试将此代码添加到第二个网格中,但它不起作用:

.HtmlAttributes(new { style="width:50% , float:right"})

or 要么

    .HtmlAttributes(new { style="width:50%"+ "float :right"})

How can i solve this and how can i change the css of the kendo grid if there is an easier way maybe using javascript parts or something? 如果有更简单的方法可能使用javascript部件或其他方法,我该如何解决这个问题以及如何更改kendo网格的CSS?

Thanks 谢谢

Define a html table of one row two columns( 50 % each) then in the each cell define a div that would become the kendo grid. 定义一行两列的html表(每列50%),然后在每个单元格中定义一个div,该div将成为剑道网格。

<div class="T0" id="L0">

<table class="tg">
 <tr>
  <th class="tg-031e">

      @(Html.Kendo().Grid<dynamic>()
.Name("GonfigGrid")
.Columns(columns =>
{
    foreach (System.Data.DataColumn c in Model.GridConfig.Columns)
    {
        columns.Bound(c.ColumnName).EditorTemplateName("String");
    }
})
.DataSource(dataSource => dataSource
    .Ajax()
    .Events(events => events.Error("error_handler"))
    .Model(model =>
    {
        foreach (System.Data.DataColumn column in Model.GridConfig.Columns)
        {
            model.Field(column.ColumnName, column.DataType);
            model.Id("Id");
        }
    })
    .Read(read =>

        read.Action("ConfigGeneric", "Configuration")
    )
))
</th>
<th class="tg-031e">


  @(Html.Kendo().Grid<dynamic>()
  .Name("StatusGrid")
  //.HtmlAttributes(new { style="width:50%;" })
    .Columns(columns =>
  {
    foreach (System.Data.DataColumn c in Model.GridStatus.Columns)
    {
        columns.Bound(c.ColumnName).EditorTemplateName("String");
    }
  })
.DataSource(dataSource => dataSource
    .Ajax()
    .Events(events => events.Error("error_handler"))
    .Model(model =>
    {
        foreach (System.Data.DataColumn column in Model.GridStatus.Columns)
        {
            model.Field(column.ColumnName, column.DataType);
            model.Id("Id");
        }
    })
    .Read(read =>

        read.Action("StatusGeneric", "Configuration")
    )
))
  </th>
   </tr>
  </table>


 </div>


<style>

  .tg  {border-collapse:collapse;
      border-spacing:0;
      width:100%;padding:0px;
      border-left:none;}
    .tg td{font-family:Arial, 
           sans-serif;font-size:14px;
                      padding:5px 5px 5px 0px;
                      overflow:hidden;
                      vertical-align:top;}
    .tg th{font-family:Arial, 
           sans-serif;
       font-size:14px;
       font-weight:normal;
       padding:5px 0px 5px 5px;
       overflow:hidden;
       vertical-align:top;}

 </style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM