可以调用其它页面的控件么? 我现在这个页面叫做WebForm1,现在想调用WebForm2页面中的Textbox1,有什么办法呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 源页面代码:把以下的代码添加到页面中public string Name{get{return TextBox1.Text;}}public string EMail{get{return TextBox2.Text;}}然后调用Server.Transfer方法private void Button1_Click(object sender, System.EventArgs e){Server.Transfer("anotherwebform.aspx");}目标页面代码:private void Page_Load(object sender, System.EventArgs e){WebForm1 wf1;//create instance of source web formwf1=(WebForm1)Context.Handler;//get reference to current handler instanceLabel1.Text=wf1.Name;Label2.Text=wf1.EMail;} 发送页: 1.定义静态变量: public static string str=""; 2. str=this.TextBox1.Text; Server.Transfer("webform2.aspx"); 接收页: 1.引入第一页的命名空间:using WebApplication1; 2 this.TextBox1.Text=WebForm1.str; 同意楼上.引用其他页面的命名空间.就可以调用了.不过要把那么的控件的私有改为public这样才能被调用 asp.net中日历控件怎么能只显示当月的天数? asp.net怎么获取当前时间——速度结贴 数据转换小问题,在线求解 HTTP500内部服务器错误,咋回事呢? 如何做到查询后能统计记录总数? datagrid编辑功能, 哪位高手帮我解决,急急 一个变量传递的问题 怎么修改Machine.Config的配置 请教一个发布的问题 如何在网页中动态加载Button控件? 求教高手,这段代码哪里出错了啊 关于模式窗口的问题
把以下的代码添加到页面中
public string Name
{
get
{
return TextBox1.Text;
}
}public string EMail
{
get
{
return TextBox2.Text;
}
}
然后调用Server.Transfer方法
private void Button1_Click
(object sender, System.EventArgs e)
{
Server.Transfer("anotherwebform.aspx");
}目标页面代码:
private void Page_Load
(object sender, System.EventArgs e)
{
WebForm1 wf1;//create instance of source web form
wf1=(WebForm1)Context.Handler;//get reference to current handler instance
Label1.Text=wf1.Name;
Label2.Text=wf1.EMail;
}
1.定义静态变量: public static string str="";
2. str=this.TextBox1.Text;
Server.Transfer("webform2.aspx");
接收页:
1.引入第一页的命名空间:using WebApplication1;
2 this.TextBox1.Text=WebForm1.str;
这样才能被调用