如何在回发中保留动态创建的控件及其数据? [英] How to preserve the dynamically created control and its data in postback?

查看:76
本文介绍了如何在回发中保留动态创建的控件及其数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生/女士,



我有像复选框这样的控件,像RadComboBox那样的telerik控件

如果我取消选中复选框,

回发将发生,然后RadComboBox(动态创建的控件)消失,然后之前保存在RadComboBox中的数据也会消失



如何在回发中保留动态创建的控件及其数据?







提前致谢

解决方案

使用 ViewState 。请在此处查看详细信息:了解ASP.NET视图状态 [ ^ ]


 受保护  void  Page_Load( object  sender,EventArgs e)
{
if (IsPostBack){

// 这里创建你的Dynamica控件..
}

}


Dear Sir/Madam,

I have the controls like checkbox,telerik control like RadComboBox
If i unselect the checkbox,
Postback will happen and then RadComboBox(dynamically created control) goes away and then the data that has been preserve previously in RadComboBox also disappear

How to preserve the dynamically created control and its data in postback?



Thanks in advance

解决方案

By using ViewState. See details here: Understanding ASP.NET View State[^]


protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack){

// Here Create ur Dynamica controls..
}

   }


这篇关于如何在回发中保留动态创建的控件及其数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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