views:

37

answers:

1

Hello all

Here is my issue.

I've a page main.aspx. This page has a button 'Settings'. When it is clicked, I load another aspx page settigns.aspx in a popup. Now in the settings.aspx i allow the users to add controls dynamically. For example the user can create 5 textboxes. When he saves it there, I need to get that controls to main.aspx.

So i need to move all the controls from one page to another page. I'm not able to think of a solution with user controls.

Any ideas on this?

A: 

Hello,

To communicate between pages, you would have to store the collection of controls in Session, Cache, or something else so that the other page could use it. That's probably not going to be viable. What you need to do is recreate the UI on the other page. So give the page the number of textboxes and values, and have that second page recreate it.

Putting this building logic in a user control would help tremendously, or figure out a way to keep them on the same page to leverage both features.

Brian
Will keeping the control collection in session or something harms in any way? Are the controls tied to the page instance?
NLV
Actually i tried it just now and it is working great. But i'm bit reluctant as i'm afraid of any downsides on storing the control collection in the session.
NLV
I would agree.... Session is per user, so you have to be careful as that might quickly max out resources for a lot of users. If you want to use this approach, what you would want to do is copy them to session, and when you get to the next page, immediately get them from session and set Session["Controls"] = null; to wipe them clean.
Brian
Hmm, stuck again. My session mode is 'SQL Server' so the controls are left non-serializable.
NLV
That probably isn't going to work then... consider storing them in cache, and append the user's ID or the current Session ID to the cache key to make it unique.
Brian