I am using ASP.Net 2.0. I added the following code in
button_Click page. but 'PreviousPage' is not taking as a
keyword. It throughs an error.

Page Poster = this.PreviousPage;

TextBox txtNewTest = (TextBox)Poster.FindControl("txtTest");

sDisplay = txtNewTest.Text;

Response.Write(sDisplay);

The following is the Error Message:

'controls_LoginMain' does not contain a definition
for 'PreviousPage'

Answer Posted / purushotham

hi u have 2 use previous page directive in page where u
want 2 access previous page controls.
aspx:

<%@ PreviousPageType VirtualPath="~/Default.aspx" %>

aspx.cs:
TextBox txt= (TextBox)Page.PreviousPage.FindControl
("TextBox1");
Response.Write(txt.Text.ToString());

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about asp.net state management?

611


Explain the various authentication mechanisms in asp.net.

483


How does the cookies work in asp.net?

550


What is web configuration file and how to use in web application

592


What is web api vs wcf?

581






can s/w quality assurance engineer switch field to programming side i m very much interested in programming but not much good in it

1417


Explain ViewState?

575


Differences between “dataset” and “datareader”.

558


What is the function of new view engine in asp.net? : asp.net mvc

536


What are the event handlers that can be included in the Global.asax file?

574


Explain what are the advantages of asp.net mvc framework? : asp.net mvc

515


What is owin authentication?

516


How can I configure asp.net applications that are running on a remote machine?

535


Describe the .net base class library.

529


What are the disadvantages of view state?

591