如何在css中的syncfusion网格分组控制中的特定单元格上添加CSS

我想在特定列上添加自定义cssClass。但是我的代码在GridRowData Bound事件中工作,但在GridHeaderRowDataBound事件中不起作用。如何在GridHeaderRowDataBound事件中添加CSS类?如何在css中的syncfusion网格分组控制中的特定单元格上添加CSS

GridRowDataBound事件:

public void Entity_GridRowDataBound(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.RowDataBoundEventArgs e, AHS.Security.Screen screen, int objectID) 

{

switch (screen.ID)

{

case 3489://Expiring Agreements

e.Row.Cells[0].CssClass = "hideColumn";

break;

}

}

GridHeaderRowDataBound事件:

 public void Entity_GridHeaderRowDataBound(object sender, Syncfusion.Web.UI.WebControls.Grid.Grouping.RowDataBoundEventArgs e, AHS.Security.Screen screen, Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableDescriptor tdescriptor) 

{

switch (screen.ID)

{

case 3489:

e.Row.Cells[0].CssClass = "hideColumn";

tdescriptor.Columns[9].HeaderText = " ";

tdescriptor.Columns[9].Name = " ";

tdescriptor.Columns[9].MappingName = " ";

break;

}

}

回答:

我们没有事件调用headerRowDataBound。你可以使用这个下面的代码更改页眉CSS

this.GridGroupingControl1.TableDescriptor.Columns[0].Appearance.ColumnHeaderCell.CssClass = "MyClass"; 

this.GridGroupingControl1.TableDescriptor.Columns[0].HeaderText = "MyHeader";

this.GridGroupingControl1.TableDescriptor.Columns[0].MappingName = "Header";

以上是 如何在css中的syncfusion网格分组控制中的特定单元格上添加CSS 的全部内容, 来源链接: utcz.com/qa/262216.html

回到顶部