SlideServe
Menu
Préférences
© SlideServe · v2026

Cross-page Postbacks

loren avatar
8 diapositives · 378 Views · Jul 31, 2014

Cross-page Postbacks. Cross-Page Posting (Introduction 1). You can use a HyperLink control to create a link to another page Any Button control can be used for cross-page postbacks Set the PostBackURL property to the desired Web page. Cross-Page Posting (Introduction 2).

Cross-page Postbacks - slide 1
01 / 8Cross-page Postbacks
1 / 17

Télécharger la présentation

Cross-page Postbacks
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Cross-page Postbacks

  2. Cross-Page Posting (Introduction 1) • You can use a HyperLink control to create a link to another page • Any Button control can be used for cross-page postbacks • Set the PostBackURL property to the desired Web page

  3. Cross-Page Posting (Introduction 2) • Use the Server.Transfer method • The target page is passed as an argument • Any code following Server.Transfer is not executed • All work is done in the context of the server Server.Transfer(“DestinationPage.aspx”);

  4. Cross-Page Posting (Getting Data from the Previous Page) • The PreviousPage property of the Page object contains a reference to the page that caused the postback • This property allows you to get at the controls from the previous form (page) and their values • This is magically accomplished through viewstate

  5. Cross-Page Posting (Example) • Get a reference to a control on another page and print the text TextBox txt; txt = (TextBox)PreviousPage.FindControl( "txtPreserve"); Response.Write(txt.Text); http://msdn.microsoft.com/en-us/library/486wc64h

  6. Detecting Cross-Page Postbasks (1) • Test the PreviousPage property to see if it is null • If it is, the page was not loaded as a cross-page postback • Test the IsCrossPagePostBack property of the ‘posting’ page

  7. Detecting Cross-Page Postbacks (2) • The @PreviousPageType directive allows you to use strongly typed syntax if page “b” will only be posted from page “a” • Be careful <%@ PreviousPageTypevirtualPath=“a.aspx” %>

  8. Cross page Postback vs. Server.Transfer • Cross page postbacks are client-based • The Transfer method is server-based • Both allow you to reference the PreviousPage property