zoukankan      html  css  js  c++  java
  • EnableViewState对Table, TableRow, TableCell不起作用?

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) { return; }      
            for (int i = 0;i<3;i++)
            {
                TableRow trTmp = new TableRow();
                trTmp.EnableViewState = true;
                for (int j=0;j<3;j++)
                {
                    TableCell tcTmp = new TableCell();
                    tcTmp.EnableViewState = true;
                    tcTmp.Text = ((int)(i * j)).ToString();
                    trTmp.Cells.Add(tcTmp);
                }
                Table1.Rows.Add(trTmp);
            }
        }
    PostBack之后,table的内容就全都消失了

    EnableViewState似乎对所有动态创建的控件都不起作用
  • 相关阅读:
    Day3-B-Round Marriage CodeForces-981F
    Day3-A-Problem H. Monster Hunter HDU6326
    Day3-G
    Day3-I-Squares POJ2002
    Day3-M-Cable master POJ1064
    Day3-N
    Day3-O-Median POJ3579
    Day3-P
    Day3-L-Cup HDU2289
    LeetCode "Majority Element"
  • 原文地址:https://www.cnblogs.com/Kerry/p/623569.html
Copyright © 2011-2022 走看看