Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine calling form?
Message
 
À
17/12/2002 11:06:52
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Divers
Thread ID:
00733615
Message ID:
00733704
Vues:
24
Hi Larry,

You would need to save the information for the label in session state. When you move to another page, the view state for the page is lost and you don't have reference to Form1.

>>>C# Newbie Question...
>>>
>>>I have a simple web form that gets called from a couple of other form using the System.Web.Transfer("WebFormName.aspx") command. (i.e. Form1 and Form2 both can call Form3.
>>>
>>>How do I determine whether Form1 or Form2 was the calling form?
>>>
>>>I know I could use a system variable and store the form's name in it and test against that, but I was wondering if there is a system function equivalent to System.Web.TransferedFrom()?
>>>
>>>TIA,
>>>Larry Long
>>>
>>>p.s. I just came back from Kevin McNeish's 5 day ASP.NET, C# for VFP Developers training and it is WELL worth it!! We had a great time, learned a lot...my brain still hurts...and Kevin treated us all very well!
>>
>>Would: Request.UrlReferrer give you what you want? It will return the URL of the previous page (ie. the referring page).
>
>Form1 - User enters name in a textbox and the OnChange method issues Server.Transfer('Form2.aspx')
>
>Form2 - Shows a label with "Hello "+username and two buttons, one to go back to Form1 and another to go to Form3
>
>The Form2.Page_Load method is
>
>if (!IsPostBack && Request.UrlReferrer.AbsolutePath == "/Hello/Form1.aspx")
>{
> Form1 sourcepage = (Form1) Context.Handler;
> Label1.Text = "Hello "+ sourcepage.TextBox1.Text;
>}
>
>Form3 - Shows other info
>
>When I return from Form3, Label1 is empty.
>How can I keep the current value in Form2.Label1?
>
>Thanks,
>Larry
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform