IMBack

Hi,

IS there away to store values between forms, without using Viewstate, sessions, or cookies,

//A class:

public class BaseClass : System.Web.UI.Page

{

private string test = "";

public string A {get{return test;} set {test=value;} }

}

my first webform1.aspx

private void bt_c_Click(object sender, System.EventArgs e)

{

BaseClass bc = new BaseClass();

bc.A = "hello world";

Response.Redirect("WebForm2.aspx");

}

after it redircts to webform2.aspx and when I try to print the value: The value is blank, why is that

BaseClass bc = new BaseClass();

Response.Write("-------<BR>"+bc.A);

Thank you,



Re: Visual C# General storing values between two forms

CommonGenius.com

The value is blank because in webform2 you are creating a new instance of BaseClass, not referencing the instance in which you set the value of A in webform1.

It sounds like you want to use a static property or session state.






Re: Visual C# General storing values between two forms

Figo Fei - MSFT

Hi,

Also, you could use QueryString or Server.Transfer.

BTW, ASP.NET related questions should be asked on http://forums.asp.net/

Thank you.