Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i dont know how to call aspx page from .cs class it is not code behind class it is other class
Posted
Comments
thatraja 12-Jun-11 2:36am    
for what? why? give us some details.
Sandeep Mewara 12-Jun-11 4:00am    
Not clear.

using Response.Redirect("Page Name ");


using this we can navigate from one page to another page
 
Share this answer
 
Comments
mohit.a44 12-Jun-11 1:27am    
response obj not in class
Without knowing more about what you are trying to do, this sounds like you have a problem in the application's class design.

ASP.Net pages are objects like all others. So far we have no problems. Other objects can call the page's methods or use its properties. All they need for that is a reference to the page object.

Unlike other objects, a page only exists for a short time. An instance of the page is created when the server receives a request. Then the page goes through a series of actions (initialization, PageLoad, events from controls, PreRender...) with the goal of generating a response which is then sent to the browser from where the page was requested. After that response has been sent, the page object is destroyed.

Your other object would need a reference to the page object to call its methods. There is no mechanism that tells a class wether or not an instance of a page exists at the moment.

And this is why I fear you may have a flaw in your design. The more logical approach would be that the page creates or obtains references to other objects and then calls their methods, not the other way around.

In such cases, when it becomes hard to make two ends in a program fit together, redesigning usually is the better way to go. This would eliminate the problem instead of working around it to cover up the symptoms.
 
Share this answer
 
Comments
mohit.a44 12-Jun-11 2:41am    
ok thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900