G
Guest
I am building a GridView dynamically adding templatFields according to a
Microsoft article. I had to create a class with the ITemplate interface and a
method called InstantiateIn.
Everything works fine except that I am unable to sort such a templatefield.
AllowSorting is true:
<asp:GridView ID="gvwPend" runat="server"
AllowSorting="True"
AutoGenerateColumns="False"
...
OnSorting="gvwPend_Sorting">
and I dynamically set SortExpression :
TemplateField tc = new TemplateField();
tc.SortExpression = "test";
tc.HeaderTemplate =
new MyDataGridTemplate(MyDataGridTemplate.Header, "MyHeader"));
tc.ItemTemplate =
new MyDataGridTemplate(MyDataGridTemplate.Item, "");
Running the code doesn't show the header with underlines and clicking on it
does not run gvwPend_Sorting.
What am I doing wrong ?
Microsoft article. I had to create a class with the ITemplate interface and a
method called InstantiateIn.
Everything works fine except that I am unable to sort such a templatefield.
AllowSorting is true:
<asp:GridView ID="gvwPend" runat="server"
AllowSorting="True"
AutoGenerateColumns="False"
...
OnSorting="gvwPend_Sorting">
and I dynamically set SortExpression :
TemplateField tc = new TemplateField();
tc.SortExpression = "test";
tc.HeaderTemplate =
new MyDataGridTemplate(MyDataGridTemplate.Header, "MyHeader"));
tc.ItemTemplate =
new MyDataGridTemplate(MyDataGridTemplate.Item, "");
Running the code doesn't show the header with underlines and clicking on it
does not run gvwPend_Sorting.
What am I doing wrong ?