Results 1 to 4 of 4

Thread: Get a value from another page

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276

    Resolved Get a value from another page

    How can you retrieve a value from one page to another?

    For example if you have Webform1 and Webform2 in the Namespace WebApplication1 I would like to do this:

    WebForm1.aspx

    Code:
    .
    .
    .
    	public class WebForm1 : System.Web.UI.Page
    	{
    		// give public access
    		public System.Web.UI.WebControls.TextBox TextBox1;
    		protected System.Web.UI.WebControls.Button Button1;
    	
    		private void Page_Load(object sender, System.EventArgs e)
    		{
    			// Put user code to initialize the page here
    		}
    
    .
    .
    .
    WebForm2.aspx

    Code:
    .
    .
    .
    	public class WebForm2 : System.Web.UI.Page
    	{
    		protected System.Web.UI.WebControls.TextBox TextBox1;
    	
    		private void Page_Load(object sender, System.EventArgs e)
    		{
    			TextBox1.Text = WebForm1.TextBox1.Text;
    			// Put user code to initialize the page here
    		}
    .
    .
    .
    The error is:

    An object reference is required for the nonstatic field, method, or property 'WebApplication1.WebForm1.TextBox1'
    Last edited by wey97; Nov 10th, 2004 at 09:50 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width