cross page posting
Cross page posting is a type of session management in which the values of Page1 are sent to Page2 using PostbackUrl attribute of the event driven items in an ASP.NET page. The event driven items in a page can be anything like a button or a link click. Instead of a event handler inside the aspx.cs file, the page takes the properties from Page1 to Page2 using the post function.
Sample Code is here
Create a page called CrossPostingParent.aspx
Let it have 2 textboxes that takes name and age and submits the data to another page CrossPostingChild.aspx using a button that has PostBackUrl set.
Corss Page Posting is a response.redirect action. So the browser shows a change in address.
CrossPostingChild.aspx inside the CrossPostingChild.aspx.cs file
This is not the only way where the data can be sent to another page using cross page posting. ASP.NET gives us a better option using the strongly typed way. In this case, we need to decorate our child class with @PrivousPage page directive and set its virtualPath property to parent page. This means that whenever there is a cross page posting it will only happen via the page defined in VirtualPath.
Apart from this, define public properties in parent class that can be used in the child class via the .PreviousPage property.The complete code is as below. I have commented the code for scenario one so that you will have a better understanding
Inside the C# file of child class Modified parent C# class file.
Hey Very nice Blog,Thanks For Sharing..
ReplyDeleteBest python training in lucknow
best summer training in lucknow
Asp.net training Center in Lucknow
MCA training In Lucknow
ReplyDeleteMCA training in Lucknow