TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Viki
NA
17
21k
Cross Page postback, public methods return null
Jul 8 2011 10:47 AM
Hi,
I am having problems with transferring data using cross-page. The public methods which supposed to return the value from the previous page textboxes, always returns null.
Code from the present page (CrossPage2) as follows:
public partial class CrossPage2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (PreviousPage != null)
{
lblinfo.Text = "You came from a page titled " +
PreviousPage.Title + "<br />";
CrossPage1 prevPage = Page.PreviousPage as CrossPage1;
if (prevPage != null)
{
lblinfo.Text += "You typed in this: " + prevPage.FullName;
}
else
{
//lblinfo.Text = "null";
}
}
}
}
Code from the previous page (CrossPage1) as follows:
public partial class CrossPage1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public TextBox FirstNameTextBox
{
get { return txtFirstName; }
}
public TextBox LastNameTextBox
{
get { return txtLastName; }
}
public String FullName
{
get { return txtFirstName.Text + " " + txtLastName.Text; }
}
}
Can someone please help me find out what's wrong here.
(I am using ASP.NET 4)
Thank you
Viki
Reply
Answers (
3
)
calender with textbox
Problem with CSS