我现在想动态的在页面上加入一些button,label和radiobuttonlist等等的一些控件。这些控件我用一个placeholder在我的代码里按需要一个个的添加进去。
页面显示没有问题。但是当我提交表单的时候发现,placeholder不能保存我加入的控件,也就是说填写的表单内容都不复存在。
我尝试将这些控件赋值为static的,但当它提交时,校验viewstate出现了问题。(MAC的问题)
求高人指点如果才能是我动态添加的控件在页面提交之后(postback),还能保持它的状态!
页面显示没有问题。但是当我提交表单的时候发现,placeholder不能保存我加入的控件,也就是说填写的表单内容都不复存在。
我尝试将这些控件赋值为static的,但当它提交时,校验viewstate出现了问题。(MAC的问题)
求高人指点如果才能是我动态添加的控件在页面提交之后(postback),还能保持它的状态!
解决方案 »
- 关于触发器的一点儿小小疑问,谢谢 (在线等结贴。。)
- 怎样可以吧list存入 session ,然后读取 购物车代码用
- ASP.NET 判断字符长度 送高分100分 十万火急!!!
- 如何在postback后,控制datagrid的数据行的显示位置?
- ADSI 的问题GetObject("WinNT:"),高分求教
- 求用asp.net(vb)树型目录的源代码
- 在线编辑器ckeditor的取值。
- 在线等待!!100分!!急!关于从Excel形式页面点击“后退“出现网页过期的问题?
- 新手入门,求教,高分求教!
- treeview超链接的问题!交差时间快到了,各位高手帮忙啊!
- 学习!
- 用.net的安装项目可以附加oracle的数据库吗?如果不可以,那改用什么安装软件
使得每次加载页面都能执行
{
DataTable dt = new DataTable();
dt = this.GetPropertyItem(obj);
int i = 0;
if(this.TableLabel.Controls.Count <= 0)
{
foreach(DataRow dr in dt.Rows)
{
TableRow tableRowLabel = new TableRow();
TableCell tableCellLabel = new TableCell(); tableRowLabel.ID = "TablerowLabel_" + i;
tableCellLabel.ID = "tableCellLabel_" + i; Label labelName = new Label();
labelName.ID = "lable_" + dr["ItemEName"].ToString();
labelName.Text = dr["ItemCName"].ToString() + ":"; tableCellLabel.Controls.Add(labelName);
tableRowLabel.Cells.Add(tableCellLabel);
this.TableLabel.Controls.Add(tableRowLabel); TableRow tableRowTextBox = new TableRow();
TableCell tableCellTextBox = new TableCell(); tableRowTextBox.ID = "TablerowTextBox_" + i;
tableCellTextBox.ID = "tableCellTextBox_" + i; TextBox textBoxName = new TextBox();
textBoxName.ID = dr["ItemEName"].ToString();
textBoxName.Text = "";
textBoxName.BorderStyle=BorderStyle.Groove; tableCellTextBox.Controls.Add(textBoxName);
tableRowTextBox.Cells.Add(tableCellTextBox);
this.TableTextBox.Controls.Add(tableRowTextBox); i++;
}
}
DataTable dt = this.GetPropertyItem(obj);
for(int i=0;i< this.TableTextBox.Controls.Count;i++)
{
TableRow tableRowTextBox = (TableRow)this.TableTextBox.FindControl("TablerowTextBox_"+i);
TableCell tableCellTextBox = (TableCell)tableRowTextBox.FindControl("tableCellTextBox_"+i);
TextBox tb = (TextBox)tableCellTextBox.FindControl(dt.Rows[i]["ItemEName"].ToString());tb.Text = dr[dt.Rows[i]["ItemEName"].ToString()].ToString();
}
http://www.cnblogs.com/lovecherry/archive/2005/04/09/134543.html
http://www.cnblogs.com/lovecherry/archive/2005/04/16/138968.html