4 Answers, 1 is accepted
Try adding a hyperlink to the control collection of the groupheader and then add an onClick attribute for the hyperlink and pass the Hyperlink text to a hidden field on the client. You can then check for the text of the clicked button and expand/collapse the group accordingly. Check out the code below to understand better:
I want the Food Category and Food Sub Category views to expand/collapse when you click on the text.
In your code you loop through the group headers. (GridItemType.GroupHeader) I am looking at the constants and am not sure what item type I should be looping though other than the GridGroupHeaderItem.
I suppose you want to expand your DetailTables on clicking their parent items. If that is the case, you can try out the following code:
Thank you again for the reply. I have been working on this issue and others so I have not had time until now to reply.
I have retrofitted your code in place and had to make a few changes and have it mostly working. The result is that when you click on either a Primary Category or Sub Category the following happens:
- The page initially loads with all the Primary and Sub categories expanded (this is fine)
- When you click on either a Primary category item or one of it's nested Sub category items the grid contracts to show *only* the outermost Primary categories. In other words only two states, all Categories and Sub Categories showing or just the root Primary category. The Food Menu Items (third and final detail table) never show.
I have the code in place and had to make a few changes to the PreRender event.
Can you see the error here because I haved spent countless hours on this issue.