Hi Kapil,
Greetings from Syncfusion support.
Query: “I am trying to define context in the header
template but the value is null. Is it possible to define context in header
template or it only works in <Template> ”
It is not possible access corresponding row details inside
header template context. We would like to inform you that using Header template
context, it is possible to retrieve the corresponding column details and we can
perform customization using column details. We have attached a code snippet
below that should be helpful in addressing your concern.
<SfGrid ID="Grid" @ref="DefaultGrid" DataSource="@Orders" AllowPaging="true">
<GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer
Name" Width="150">
<HeaderTemplate>
@{
var a = (context as GridColumn);
}
</HeaderTemplate>
</GridColumn>
</GridColumns>
</SfGrid>
|
If you still face difficulties then kindly get back to us
with additional details about your requirement.