Cross-Page Postbacks Made Easy with .NET 2.0
page 3 of 3
by Shaun Eutsey
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 31118/ 76

Conclusion

I think that Cross Page Postbacks have been largely forgotten about because of the other advantage that .NET has brought. The ease of using one page to do all of the work has made the need for doing a cross-page postback more rare than it was "back in the day." However, the next time you find yourself type Server.Transfer or Response.Redirect, look a little deeper at that you are doing, and ask yourself if a cross-page postback would serve your needs better.


View Entire Article

User Comments

Title: Good piece   
Name: Vino
Date: 2008-09-26 10:19:14 AM
Comment:
Really a good piece of article in a simplest way possible. Good Effort. Keep up the good work.
Title: Re: Limitation(s)   
Name: Florin Labou
Date: 2007-11-09 8:16:02 AM
Comment:
When you need to postback from more pages to Page2.aspx you'll need to define a 'contract' that describes the list of expected transferred values to Page2.aspx.

When Page1.aspx and Page3.aspx need to postback to Page2.aspx you may create a base page:
public abstract class SourceBasePage : System.Web.UI.Page
{
public abstract Int32 MessageID { get; }
public abstract String Subject { get; }
public abstract String Message { get; }
}
Page1.aspx and Page3.aspx should inherit from this SourceBasePage. Page2.aspx should describe the previous page type by TypeName:
<%@ PreviousPageType TypeName="MyNamespace.SourceBasePage" %>

So one solution is inheritance.

I hope this will help.

Regards,
Florin Labou
Title: nice article   
Name: Sandeep
Date: 2007-11-09 6:34:02 AM
Comment:
Really good information presented in simple to understand manner!
Title: Limitation ?   
Name: Abdul wahab
Date: 2007-11-05 1:53:58 AM
Comment:
thats a nice article written
my question is : what if my page 2 expect input from two different pages in that case how will previous page will work
Title: Limitations   
Name: Pawan Bansal
Date: 2007-10-31 1:37:03 AM
Comment:
Hi Shaun!

thanks for writing this article. but the whole concept still has limitations that restricts the use of this concept. You should have a one way channel of the forms to be called like here Page1 is calling Page2. what if the Page2 needs to opened from many other pages as well. Like doing some common functionality from various pages and passi ng the query filter from each page. This will not help in that scenario. Moreover if in any case Page2 calls back Page1 then also it is going to fail.

I think the concept still needs a lot more to be done for a real time useful utility.
Title: Awesome!!   
Name: Nishanth Nair
Date: 2007-10-31 12:51:11 AM
Comment:
Very good article. Written in plain simple english. Was very useful.
Title: It's Works fine!   
Name: Azad
Date: 2007-10-31 12:22:59 AM
Comment:
Thanks for your nice article .Its really good .
Title: Very Nice!!   
Name: siva
Date: 2007-10-31 12:08:43 AM
Comment:
Very Nice Article !!!!!!
Title: Newbie Learning   
Name: Barney3012
Date: 2007-10-29 7:30:04 AM
Comment:
As a newbie things like this are really useful. I have used the old redirect a few times and as a new person you do not often see ways of doing the basics like moving values from page to page. This is a very useful article.
Thanks for taking the time

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-08-18 5:42:01 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search