I have attached a sample project trying top get the sample code from the Item Template help here working.
I'm using GrpoupBy against a flat entity object. I can not get the control added in the CustomTemplate to appear.. What am I going wrong?
Your help and pointers what am I doing wrong is greatly apreciated.
Thanks in advance for having a look.
Emil
Dave,
thanks for your answer & patience.
Obviously I can read but can not see :)
Hi,
Please reread my post. The line I posted is not the same. Setting the template on the WHDG column is NOT the same as setting it on the GridView column. As I said, once the GridView columns are created, any changes made to the corresponding column in the WHDG (its Band) are NOT carried down. So, setting the template on that column does nothing, since that is not the grid getting rendered. If you are using the event, you are better off doing
TemplateDataField templateColumn = (TemplateDataField)e.RowIsland.Columns["action"];
This is the ContainerGrid that will actually render. Modifying this column is what needs to happen. In your case (with one level), this is the same as modifying the GridView column.
-Dave
David,
I already do this in my sample see line 17:
TemplateDataField
my understanding is (correct me if I'm wrong) that I can override the column template by assigning the custom class ActionItemTemplate() in the code I sent for the "action" column.
I also have another column template in the grid markup called "test" I also tried applying the custom template class to it but I can't get it to show Edit.
I have a TemplateDataField in the markup then on RowIslandDataBinding event I get reference to the template field and replace the column.ItemTemplate with instance of my custom template class... is this the right thing to do?
I still can't get the control in the custom template class to display, what am I doing wrong?
thank you!
Edit should appear - I couldn't figure out why it doesn't.
I'm just about to try what you said...
Hi Emil,
I'm a little confused. What template should appear? Approve/Remove or Edit? If you want the edit one to appear, you need to set the template in the GridView column. Once the grid view is created, it no longer copies properties set on its band, the WHDG.
So do this.
TemplateDataField templateColumn = (TemplateDataField)this.WebHierarchicalDataGrid1.GridView.Columns["action"];
And you'll get Edit to appear.
regards,
David Young