如何通过回发保持我的运行时控件值? [英] how to keep my run-time controls value through post-back?

查看:70
本文介绍了如何通过回发保持我的运行时控件值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行时只有一个表头的表,当在这些控件中输入数据并单击保存单击事件代码(如
)时,会生成并向我的表添加控件行(dropdownlist-textbox-labels)

i have table with only table heads in run-time generate and add rows of controls (dropdownlist-textbox-labels) to my table when enter data in these controls and click save click event code like

for (int iRow = 1; iRow < Table1.Rows.Count; iRow++)
      {
          for (int iCol = 1; iCol <= 8; iCol++)
          {
              if (Table1.Rows[iRow].Cells[iCol].Controls.Count > 0)
              {
                  DropDownList odocType = (DropDownList)grid_Doc.Rows[iRow].Cells[iCol].Controls[0];
                  oImage.DocType =MainClass.GetInteger( odocType.SelectedValue);

              }
          }
      }




我发现Table1.Row = 1(th),当我搜索这些问题时,我发现页面生命周期擦除了我在循环遍历表时在欠时创建的控件,但我没有找到所有行,并且控件中没有任何一个可以帮助我




i found Table1.Row =1 (th) when searched about these problem i found that page life cycle erase my controls created at runt-time when loop through my table i didn''t found all row and controls can any one help me plz

推荐答案

尝试使用Session,如ASP.NET会话状态概述 MSDN主题.

Try to use the Session, as described in the ASP.NET Session State Overview MSDN topic.


您需要使用以下一种状态管理技术来实现它:
MSDN:ASP.NET状态管理概述 [ ASP.NET中的状态管理-1 [ ASP.Net状态管理技术-2 [
You need to use one of the state management techniques to implement it:
MSDN: ASP.NET State Management Overview[^]
State management in ASP.NET - 1[^]
ASP.Net State Management Techniques - 2[^]


这篇关于如何通过回发保持我的运行时控件值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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