我再后台动态生成几个控件
比如是TABLE
代码如下:其实每必要仔细看,
我的意思是,由于WEB程序提交一次服务器后, 我所生成的TABLE只能再从新建立
我只能记下他的个数后再循环生成TABLE
但是我想有没有途径能将该TABLE存下来, 等提交服务器后 在一次取出来进行处理
能实现吗???
private void AgreeProcedure()
{
int count=0;
int numberX=0;
int numberY=150;
string ID="";
int offsetX=0;
int offsetY=0;
int left=0;
int top=0;
int width=200;
int height=50;
            ViewState["id"]=Convert.ToInt32(ViewState["id"])+1;
for(int i=0;i<Convert.ToInt32(ViewState["id"]);i++)
{
count++;
//ViewState["id"]=id;
//ViewState["count"]=count;
ID=ViewState["id"].ToString();
offsetX=numberX*count;
offsetY=numberY*count;
//ViewState["LeftPosition"]=left;
//ViewState["TopPosition"]=top;
left=Convert.ToInt32(ViewState["LeftPosition"])+offsetX;
top=Convert.ToInt32(ViewState["TopPosition"])+offsetY;

if(i>=1)
DisplayImage2(left+80-numberX,top+20-numberY);
System.Web.UI.HtmlControls.HtmlTable table1=new HtmlTable();
HtmlTableRow row=new HtmlTableRow();
for(int j=0;j<2;j++)
{  
System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox=new HtmlInputCheckBox();
checkbox.ID=j.ToString();
HtmlTableCell cell = new  HtmlTableCell();
if(j==0)
{
cell.Style.Add("width","50");
}
cell.Controls.Add(new LiteralControl(j.ToString())); 
cell.Controls.Add(checkbox);
row.Cells.Add(cell);
table1.Rows.Add(row);
}
table1.ID=ID;
  
//table1.Visible=true;
table1.Style.Add("position","absolute");
table1.Style.Add("left",left.ToString()+"px");
table1.Style.Add("top",top.ToString()+"px");
table1.Style.Add("width",width.ToString());
table1.Style.Add("height",height.ToString());
table1.Border=1;

this.Controls.Add(table1);
if(Convert.ToInt32(ViewState["id"])==2)
{
      AddAgreeProcedure();
AddNotAgreeProcedure();
 
}

}
ViewState["FinalLeftPosition"]=left;
ViewState["FinalTopPosition"]=top;

}