Why can't I use the CrossPage1.aspx page objects in the CrossPage2.aspx page. For example, on the CrossPage2.aspx page I have an ESRP one lable and I want to write in this lable text regarding the CrossPage1.aspx page, does not work, what are the problems?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CrossPage1.aspx.cs" Inherits="CrossPage1" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>CrossPage1</title> </head> <body> <form id="form1" runat="server" > <div> <asp:TextBox runat="server" ID="txtFirstName"></asp:TextBox> &nbsp; <asp:TextBox runat="server" ID="txtLastName"></asp:TextBox> <asp:Button runat="server" ID="cmdSubmit" PostBackUrl="CrossPage2.aspx" Text="Submit" /> </div> </form> </body> </html> 
  • So, do not pay attention to my answer, I am writing a rare crap today. - Olter

1 answer 1

This is not Delphi and Winforms, in which you did this. Here you can not do this! The first page does not know anything about the second! In order to transfer data from one page to another there are a lot of ways: transfer by post or gett in a request, use a session, cookie, cache, file system, database, etc. ... Learn the mat part and start with the life cycle of the page.

  • But unless the properties of PreviousPage are not for this ?????? In the book this is written, but it turns out to be used normally - Arman777
  • You can use this and sv-in the page. Cleaned up the komenty with the code, but I do not remember what you had there But in general, this is how it should work: msdn.microsoft.com/ru-ru/library/… - wind
  • The question just about PreviosPage does not say anything ... - wind