动态控件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);
cell = new TableCell();
cell.Text = STRCELL4;
cell.Width = 80;
row.Cells.Add(cell);
for (int j = 0; j < 4; j++)
{
cell = new TableCell();
box = new TextBox();
box.MaxLength = 9;
box.Width = TXTBOXWIDTH;
box.Attributes.Add( "class ", "commonTextNumber ");
box.Enabled = false;
cell.Controls.Add(box);
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = STRCELL5;
row.Cells.Add(cell);
box.Attributes.Add( "onpropertychange ", @ "JavaScript:if(/[^0-9\,]/g.test(value))value=value.replace(/[^0-9\,]/g, ' ') ");
box.Attributes.Add( "onblur ", @ "JavaScript:tbPriceGetBlur(this); ");
box.Attributes.Add( "onfocus ", @ "JavaScript:tbPriceGetFocus(this); ");
}
table1.Rows.Add(row);
}
}
[解决办法]
js 节点控制