zoukankan      html  css  js  c++  java
  • ASP.NET中页面传递参数。

    第一页面用Server.Transfer跳转至第二页面。
    第二页面中核心代码如下:
    if(!Page.IsPostBack)
       {    
        Webtest1 _webtest1;
        _webtest1 = (Webtest1) Context.Handler;
        if(_webtest1!=null)
        {
         ViewState["TNum"] = System.Convert.ToInt32(((TextBox)_webtest1.FindControl("TextBox1")).Text.Trim());     
        }
       }
       table1.Controls.Clear();
       if(System.Convert.ToInt32(ViewState["TNum"].ToString())>0)
       {
        for(int i=0;i<System.Convert.ToInt32(ViewState["TNum"].ToString());i++)
        {
         HtmlTableRow tr = new HtmlTableRow();
         HtmlTableCell cell = new HtmlTableCell();
         TextBox newbox = new TextBox();
         newbox.Text = "第"+i.ToString()+"个";
         newbox.Width = 180;
         newbox.ID = "DynTextBox"+i.ToString();
         newbox.Attributes.Add("name", newbox.ID);
         //ViewState[newbox.ID] = newbox;
         cell.Controls.Add(newbox);
         tr.Controls.Add(cell);
         table1.Controls.Add(tr);
        }
       }
    //获取动态生成控件中的内容。
       string res ="";
       for (int i=0;i<System.Convert.ToInt32(ViewState["TNum"].ToString());i++)
       {
        //res = this.Controls[i].ID;
        //Control myControl1 = FindControl("DynTextBox"+i.ToString());
        TextBox txt0 = (TextBox)this.FindControl("DynTextBox"+i.ToString());
        res+= txt0.Text;    
       }
       Response.Write(res); 
  • 相关阅读:
    harbor1.9仓库同步迁移
    接口强制删除namespace 为Terminating的方法
    k8s 命令自动补全
    docker harbor 搭建&配置http/https 方法
    docker harbor 清理释放存储空间
    强化学习系列
    Kaggle的Outbrain点击预测比赛分析
    talkingdata比赛分析
    keras模型总结
    深度神经网络多任务学习(Multi-Task Learning in Deep Neural Networks)
  • 原文地址:https://www.cnblogs.com/joxin/p/77001.html
Copyright © 2011-2022 走看看