Hi all,
I have a template column in my grid. The text of this column is derived by feeding the auditor ID (which is part of the table which is the datasource of the grid) through a function in my code. This gives me the name of the auditor. The template column looks like this:
<
trt:GridTemplateColumn
HeaderText
=
"AuditorId"
FooterText
=
"Total Hours"
>
<
HeaderTemplate
>
<
asp:LinkButton
ID
=
"btnAuditorId"
Text
=
"AuditorId"
ToolTip
=
"Sort by Auditor ID"
CommandName
=
'Sort'
CommandArgument
=
'AudrId'
runat
=
"server"
>
</
asp:LinkButton
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblAudDescr"
runat
=
"server"
Text='<%# ctl.GetAuditorDescr( DataBinder.Eval(Container, "DataItem.AudrId"))%>' />
</
ItemTemplate
>
</
trt:GridTemplateColumn
>
This works beautifully to fill my grid, but now I want to use the EnableHeaderContextMenu functionality. Works well for all the other columns (which are bound columns) but when I try to use it on this column I get an error stating "Expression cannot be null or empty".
I tried setting the groupByExpression in the <trt:GridTemplateColumn> to "ctl.GetAuditorDescr(AudrId)" but then I get an error stating "Invalid group by expression: 'Group By' clause missing".
How can I feed the AudrId, which is part of the datasource, through my GetAuditorDescr function and then group by those results?