简体   繁体   English

将带有控件的整个布局从一个aspx页复制到另一页-动态移动控件-ASP.Net

[英]Copying the whole layout with controls from one aspx page to another page - Moving Controls dynamically - ASP.Net

Here is my issue. 这是我的问题。

I've a page main.aspx. 我有一个页面main.aspx。 This page has a button 'Settings'. 此页面上有一个“设置”按钮。 When it is clicked, I load another aspx page settigns.aspx in a popup. 单击它时,我会在弹出窗口中加载另一个aspx页面settigns.aspx。 Now in the settings.aspx i allow the users to add controls dynamically. 现在在settings.aspx中,我允许用户动态添加控件。 For example the user can create 5 textboxes. 例如,用户可以创建5个文本框。 When he saves it there, I need to get that controls to main.aspx. 当他将其保存在此处时,我需要将该控件添加到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? 有什么想法吗?

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. 要在页面之间进行通信,您必须将控件集合存储在Session,Cache或其他内容中,以便其他页面可以使用它。 That's probably not going to be viable. 那可能是行不通的。 What you need to do is recreate the UI on the other page. 您需要做的是在另一页上重新创建UI。 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. 将这种构建逻辑放在用户控件中将极大地帮助您,或者找出一种使它们保持在同一页面上以利用这两个功能的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM