我再后台动态生成几个控件
比如是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;
}
比如是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;
}
解决方案 »
- 在网页中怎么才能画一条虚线
- 如何删除DataGrid里的一条记录,而且更新数据库!
- ** 比较难的问题 怎样将html解析为xml **
- CodeSmith生成代码的问题.
- 如何判断两个日期相等?
- 求JS:弹出窗口问题
- datagrid的模板列中的textbox的change事件!
- 如何获得系统目录的名字呢?
- 求助导出excel表无法在2010中看,出现的是乱码
- 请教一个入门级的小问题!!
- 请问:using Microsoft.Office.Interop.Excel;这个引用是需要调用那个com?在那里可以下到?
- 跪求此题--分页显示的搜索数据,在下拉框选择第几页时,自动变化了,原搜索内容变为搜索空值的内容。
但是高人怎么实现