如何在syncfusion网格分组控件的网格列中添加cssClass?

时间:2017-12-11 04:10:51

标签: grid syncfusion

我需要在rowdatabound事件中的syncfusion网格分组控件中为特定网格列添加cssclass。我不知道syntext。请帮帮我。

1 个答案:

答案 0 :(得分:0)

Refer the below code example for using the  cssClass inside the RowDataBound event. Here you can use apply custom css based on your contidion 

//Enable RowDataBound event
            this.GridGroupingControl1.RowDataBound += new RowDataBoundEventHandler(GridGroupingControl1_RowDataBound);

void GridGroupingControl1_RowDataBound(object sender, RowDataBoundEventArgs e)
        {
            if (e.Element.Kind == DisplayElementKind.Record)
            {
                for (int i = 0; i < e.Row.Cells.Count; i++)
                {

                    if (((Syncfusion.Web.UI.WebControls.Grid.Grouping.GridCell)(e.Row.Cells[i])).ColumnDescriptor.Name == "ShipCity")
                    {//Apply cssClass inside the RowDataBound event
                        e.Row.CssClass = "MyClass";
                    }
                }
            }
        }