一段.net的后台代码 写成Javascript脚本怎么实现啊? 很急 求帮助 谢谢了! 20
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSys...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 1; i <= Count; i++)
{
LoadUserControl(i);
}
}
int Count
{
get
{
if (ViewState["ControlCount"] == null)
{
ViewState["ControlCount"] = 0;
}
return (int)ViewState["ControlCount"];
}
set
{
ViewState["ControlCount"] = value;
}
}
protected void LoadUserControl(int index)
{
Control ctl = this.LoadControl("WebUserControl.ascx");//用户控件的名字
ctl.ID = string.Format("userControl_{0}", index);
this.Panel1.Controls.Add(ctl);//这个panel1是在用户控件里面设计格式的时候用到的,你想要添加的教育经历的格式放到一个容器里面,也可以是别的
}
//点击按钮,添加一个用户控件
protected void Button1_Click(object sender, EventArgs e)
{
Count++;
LoadUserControl(Count);
}
} 展开
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 1; i <= Count; i++)
{
LoadUserControl(i);
}
}
int Count
{
get
{
if (ViewState["ControlCount"] == null)
{
ViewState["ControlCount"] = 0;
}
return (int)ViewState["ControlCount"];
}
set
{
ViewState["ControlCount"] = value;
}
}
protected void LoadUserControl(int index)
{
Control ctl = this.LoadControl("WebUserControl.ascx");//用户控件的名字
ctl.ID = string.Format("userControl_{0}", index);
this.Panel1.Controls.Add(ctl);//这个panel1是在用户控件里面设计格式的时候用到的,你想要添加的教育经历的格式放到一个容器里面,也可以是别的
}
//点击按钮,添加一个用户控件
protected void Button1_Click(object sender, EventArgs e)
{
Count++;
LoadUserControl(Count);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询