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'

Answers were Sorted based on User's Feedback



I am using ASP.Net 2.0. I added the following code in button_Click page. but 'PreviousPage�..

Answer / 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

I am using ASP.Net 2.0. I added the following code in button_Click page. but 'PreviousPage�..

Answer / geetha

Hi Purushotham,

Thank you very much for your suggestions.Now its working
fine.


Thanks,
Geetha

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

How do I force the dispose method to be called automatically, as clients can forget to call dispose method?

0 Answers  


Which is better asp.net or php?

0 Answers  


How does asp.net work?

0 Answers  


What are different templates available in Repeater,DataList and Datagrid ?

1 Answers  


What is the concept of view state in asp.net?

0 Answers  






What is is post back property in asp net?

0 Answers  


what is differences between bind and eval?

2 Answers  


What is a web api endpoint?

0 Answers  


What is .netmodule and how is different from .dll and .exe

2 Answers   NIIT,


how to add cliet side event to server side? and how to register client script to sever side? wt difference these two

3 Answers   PSI Data Systems,


What are validator? Name the validation controls in asp.net?

0 Answers  


What's the advantage of using System.Text.StringBuilder over System.String?

3 Answers   IBM, IdeaLake, Infosys,


Categories