跨页面的传送
2009-12-11 21:40
155 查看
一直接查找控件
TextBox pp_Textbox1;
Calendar pp_Calendar1;
pp_Textbox1 = (TextBox)PreviousPage.FindControl("Textbox1");
pp_Calendar1 = (Calendar)PreviousPage.FindControl("Calendar1");
二将控件封装成属性
page1:
public TextBox pp_TextBox1
{
get
{
return TextBox1;
}
}
public Calendar pp_Calendar1
{
get
{
return Calendar1;
}
}
page2:
Label1.Text = "Hello " + PreviousPage.pp_TextBox1.Text + "<br />" +
"Date Selected: " +
PreviousPage.pp_Calendar1.SelectedDate.ToShortDateString();
或者
if (PreviousPage != null && PreviousPage.IsCrossPagePostBack) {
Label1.Text = "Hello " + PreviousPage.pp_TextBox1.Text + "<br />" +
"Date Selected: " +
PreviousPage.pp_Calendar1.SelectedDate.ToShortDateString();
}
else
{
Response.Redirect("Page1.aspx");
}
TextBox pp_Textbox1;
Calendar pp_Calendar1;
pp_Textbox1 = (TextBox)PreviousPage.FindControl("Textbox1");
pp_Calendar1 = (Calendar)PreviousPage.FindControl("Calendar1");
二将控件封装成属性
page1:
public TextBox pp_TextBox1
{
get
{
return TextBox1;
}
}
public Calendar pp_Calendar1
{
get
{
return Calendar1;
}
}
page2:
Label1.Text = "Hello " + PreviousPage.pp_TextBox1.Text + "<br />" +
"Date Selected: " +
PreviousPage.pp_Calendar1.SelectedDate.ToShortDateString();
或者
if (PreviousPage != null && PreviousPage.IsCrossPagePostBack) {
Label1.Text = "Hello " + PreviousPage.pp_TextBox1.Text + "<br />" +
"Date Selected: " +
PreviousPage.pp_Calendar1.SelectedDate.ToShortDateString();
}
else
{
Response.Redirect("Page1.aspx");
}
相关文章推荐
- servlet传送数据给jsp页面
- 前端页面利用AJAX将数组数据传送到后台
- 利用jquery ajax读取下拉多选框的值,并向php页面传送的具体代码如下
- Asp.net 2.0 跨页面的传送
- URL、Session、Cookies、Server.Transfer、Application和跨页面传送。
- Action向页面传送Json类型数据以及myBatis一对多查询
- URL、Session、Cookies、Server.Transfer、Application和跨页面传送详解
- 通过url向页面传送html或JavaScript标签
- 使用XMLHttp在页面间传送参数
- json_后台传送json格式的对象到前台页面
- 跨页面传送
- 温故知新--跨页面的传送(一)
- asp.net 2.0中利用Ajax2.0实现JSON传送大量页面数据
- GWT1.7学习之后台传送pojo到前台页面.RPC调用
- 如何在ASP.NET页面间传送数据
- asp.net 2.0中利用Ajax2.0实现JSON传送大量页面数据
- 从JSP页面传送动态图片
- 跨页面的传送(一)
- 页面传送中文值与Server.UrlDecode编码问题
- jquery用添加按钮把数据传送给PHP页面