C#中的交叉分页给出了错误 [英] Cross Paging in C# giving error
问题描述
我正在尝试分页,以下是第2页的代码:
if(this.PreviousPage!= null)
{
TextBox TextBox1 =(TextBox)this.PreviousPage.FindControl(TextBox1);
Calendar Calendar1 =(Calendar)this.PreviousPage.FindControl(Calendar1 );
Label1.Text = Convert.ToString(Hello {0} !!!!你选择日期为{1}+ TextBox1.Text.Trim()+ Calendar1.SelectedDate);
}
它不显示标签文本,如果我尝试删除if()则它会给出错误对象参考没有设置为对象的实例。
请帮助
I am trying to do paging and following is the code for page 2:
if (this.PreviousPage != null)
{
TextBox TextBox1 = (TextBox)this.PreviousPage.FindControl("TextBox1");
Calendar Calendar1 = (Calendar)this.PreviousPage.FindControl("Calendar1");
Label1.Text = Convert.ToString("Hello {0}!!!! u have selected date as {1}" + TextBox1.Text.Trim() + Calendar1.SelectedDate);
}
it does not display the label text and also if i try remove the if() then it gives the error "Object reference not set to an instance of an object."
Please help
推荐答案
交叉分页被延迟。不要用它。使两个页面控件都托管在同一页面上。根据你没有向我们展示的代码,你显然没有做到这一点。
Cross paging is retarded. Don''t use it. Make both pages controls hosted on the same page. As it stands, you''re clearly not doing it right, based on code you did not show us.
这篇关于C#中的交叉分页给出了错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!