日期:2014-05-19  浏览次数:20441 次

动态控件TextBox的取值与控制
在Table中增加了TextBox控件,如何取某行某列的值?并设置其Enabled属性!还有取全部TextBox值?请各位帮忙啊:    
建立方法:
  private   void   InitValueTable(Table   table1,   int   startIndex)
        {
                TableRow   row   =   null;
                TableCell   cell   =   null;
                TextBox   box   =   null;
                Label   label   =   null;

                InitFirstRow(table1);
                table1.Attributes.Add( "Border ",   "1 ");
                table1.Attributes.Add( "BorderColor ",   "black ");              

                for   (int   i   =   0;   i   <   ROWS   -   1;   i++)
                {
                        row   =   new   TableRow();
                        cell   =   new   TableCell();

                        label   =   new   Label();
                        label.Width   =   LABLEWIDTH;
                        desList.Add(label);
                        cell.Controls.Add(label);
                        row.Cells.Add(cell);

                        cell   =   new   TableCell();
                        cell.Text   =   STRCELL3;
                        row.Cells.Add(cell);

                        cell   =   new   TableCell();
                        box   =   new   TextBox();
                        box.Width   =   TXTBOXWIDTH;
                        box.Attributes.Add( "class ",   "commonTextNumber ");  
                        box.MaxLength   =   9;
                        box.Enabled   =   false;

                        srcList.Add(box);
                        cell.Controls.Add(box);
                        row.Cells.Add(cell);