Hi,
On the attached sample you will find a website where by clicking on the top botton a node with the textbox's text is added to a tree. You can add as many as you want.
The problem comes when you check some nodes and then click the button on the bottom which on its handler counts the checked nodes.
After the postback, the checkboxes text disappears.
The reason why We are using Template is because we want only some nodes to have a checkbox but not all of them so CheckBoxMode is not adequate.
Can you give me any advice?
Thanks in advance.
Hello rickycl ,
Thank you for posting in our forum.
I see you’re referring to an attached sample but I can’t see any attachment. Can you try attaching it again?
It would be enough to provide the mark-up and the code behind of the page.
I’m looking forward to your reply.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Sorry about that, already edited the post.
Thanks!
I'm just following up to see if you have any further questions or concerns.
If so don't hesitate to contact me.
Hello Maya,
Sorry for the late response.
I tried your suggestion and it worked fine, even though, I still have two doubts:
- Why did the text only dissappear when there was not checked checkboxes ? (if you do not check any of them it will work fine)
- What is the recommended approach when using controls with templates like this one? I mean, do I have to always handle Page_Load event and set properties like text again? We would prefer we didn't.
Thank you very much.
The first time you add the new node you do it on a button click event during which the creation of the template is initialized and the values are set as expected.
Then I think that the node values are persisted in the view state until you make changes to checkbox state. Then on Init the values for the nodes are not yet available.
So you’ll need access them later in the page life cycle.
The issue in this case is not the template itself since it initializes and behaves as expected. It’s the node values that are not yet available on Init. If you set a static value for the text or a value that is available in this early stage of the page lifecycle it will work as expected. Still if you need to set values such as the text of the node it would be best to access them after the initialization has completed and the values have been properly populated. That would be any event after Init.
I hope this was helpful. Let me know if you still have any questions.