Discussion Locked

Getting text value from another form in same project

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Dear all,
In ASP.Net, I have one main webform and again I added some more forms...I have created one label in form2.This lable having some text.I want to get the text in form3.(I want to show the same text in form3.)How to do it?If it is label1 in form2,I try to get the text in form3 by coding form2.label1.text. but it is not working.
How to do this>
Please let me know
Thanks and Regards,
Satheesh.B

1 reply

by bschaettle

When you say "forms" I assume you mean separate aspx files. Remember that these are webpages, so only one is instantiated in memory at any given time so you really can't directly refer to a label on another form. There are several ways to pass information from page to page, but a Session variable may be a good choice. You can find plenty of documentation on the MSDN website. Try this for a starting point:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsessionstate.asp

This discussion is closed to new replies.