动态控制和回传 [英] Dynamic Controls and Postback

查看:111
本文介绍了动态控制和回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个面板。现在,在该面板,我添加控件。它是获取添加和displayed.The问题是,当页面发布,背部装有知道这些控件必须在面板再次绑定。但让说,如果用户输入在动态创建的文本框中键入一些值。它是迷路..

I have a Panel. Now in that panel, i'm adding controls. It is getting added and displayed.The problem is when the page is posted back.I know the controls have to be binded again in the panel. But lets say if the user has entered some value in the dynamic created text box. Its is getting lost..

推荐答案

我以前通过存储在会话从控制数据做到了这一点。

I have done this before by storing the data from the controls in session.

每次动态添加控件,存储订立会话或视图状态例如控制当前的数据,然后在回发重新绑定。不是最优雅的解决方案,但它的工作。我把它这是一个web表单的问题?

Every time you dynamically add a control, store the current data entered into the controls in session or viewstate for example, and then rebind on postback. Not the most elegant solution but it worked. I take it this is a webforms question?


  1. 添加动态控制点击

  2. 保存当前表单数据

  3. 在Page_Load中从视图状态的数据加载到控制

这篇关于动态控制和回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆