PDA

View Full Version : get panels created in the primary panel in code behind



TAYMA
Sep 28, 2020, 4:07 PM
hi
I have a panel and for doing some jobs user can to add another panel to this panel. I do this task by following code


panel.AddTo(this.GetCmp<Panel>("PanelJou"));
panels that add are closable and user can remove them at the end i need to get title id and html of inner panels that remain .but no method i find for this .
I have to access it in code behind but i cant get items of primary panel by this code

var Allitem = X.GetCmp<Panel>("PanelJou").Items;

I would be grateful if anyone could suggest a way to do this

fabricio.murta
Oct 01, 2020, 9:34 PM
Hello @TAYMA,

What you are talking about seems to be a limitation related to ASP.NET pages life cycle. Code behind cannot always know the exact state of client-side, unless all the relevant state is actually transmitted back during the server call. We cannot always pass everything as it would just overload every request with things that are seldom necessary.

So in a generic approach, what you can't get from code behind, like the items you dynamically added to a panel needs to be passed along the client-to-server call. For a lot of situations it should work without effort but for some specific scenarios, like the one you're describing, you would need to pass the state (panels, and their contents, however you can to minimize data throughput -- that's going to be a client upload) in order to work with them from code behind.

This is as far as we can go with a response given the provided bits. If you need specific directions I'm afraid we'd need a test case reproducing your scenario so we can tell you exactly what you need to do to attain your objective.

Sometimes it is profitable to rely a little more from client-side code and pass mostly "processed data" back to the server, to minimize client-server communication data amount.

If in doubt how to make a test case we can use, please review our threads on general forum guidelines, there are nice examples in there I'm sure you can base your test case from.

- Tips for creating simplified code samples (http://forums.ext.net/showthread.php?61176-Tips-for-creating-simplified-code-samples)
- More Information Required (http://forums.ext.net/showthread.php?10205-More-Information-Required)
- Forum Guidelines (http://forums.ext.net/showthread.php?3440-Forum-Guidelines-For-Posting-New-Topics)

Examples explorer (https://examples5.ext.net/) is also a great source of test case outlines.

Hope this helps!